<commit_before><?php

namespace Respect\Validation\Rules;

use Respect\Validation\Validatable;
use Respect\Validation\Validator;
use Respect\Validation\Exceptions\ValidationException;

abstract class AbstractRule implements Validatable
{

    protected $name;
    protected $template = null;

    public static $translator = null;

    public function __construct()
    {
        //a constructor is required for ReflectionClass::newInstance()
    }

    public function __invoke($input)
    {
        return $this->validate($input);
    }

    public function not(Validatable $rule = null)
    {
        return new Not($rule ?: $this);
    }

    public function addOr() {
        $rules = func_get_args();
        array_unshift($rules, $this);
        return new OneOf($rules);
    }

    public function assert($input)
    {
        if ($this->validate($input))
            return true;
        else
            throw $this->reportError($input);
    }

    public function check($input)
    {
        return $this->assert($input);
    }
<commit_msg>Fixed problem with static methods<commit_after><?php

namespace Respect\Validation\Rules;

use Respect\Validation\Validatable;
use Respect\Validation\Validator;
use Respect\Validation\Exceptions\ValidationException;

abstract class AbstractRule implements Validatable
{

    protected $name;
    protected $template = null;

    public static $translator = null;

    public function __construct()
    {
        //a constructor is required for ReflectionClass::newInstance()
    }

    public static function __callStatic($ruleName, $arguments)
    {
        return Validator::__callStatic($ruleName, $arguments);
    }

    public function __invoke($input)
    {
        return $this->validate($input);
    }

    public function not(Validatable $rule = null)
    {
        return new Not($rule ?: $this);
    }

    public function addOr() {
        $rules = func_get_args();
        array_unshift($rules, $this);
        return new OneOf($rules);
    }

    public function assert($input)
    {
        if ($this->validate($input))
            return true;
        else
            throw $this->reportError($input);
    }

    public function check($input)
    {
        return $this->assert($input);
    }

{'fraction_non_alphanumeric': 0.10747456877487838, 'fraction_numerical': 0.0, 'mean_word_length': 2.6601941747572817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7582987', 'n_tokens_mistral': 623, 'n_tokens_neox': 607, 'n_words': 154}