Bluz\Validator\Validator::__call PHP Method

__call() public method

Magic call for create new rule
public __call ( string $ruleName, array $arguments ) : Validator
$ruleName string
$arguments array
return Validator
    public function __call($ruleName, $arguments)
    {
        if (in_array($ruleName, ['array', 'float', 'string'])) {
            $ruleName .= 'Input';
        }
        $ruleClass = '\\Bluz\\Validator\\Rule\\' . ucfirst($ruleName);
        if (!class_exists($ruleClass)) {
            throw new ComponentException("Class for validator `{$ruleName}` not found");
        }
        if (sizeof($arguments)) {
            $reflection = new \ReflectionClass($ruleClass);
            $rule = $reflection->newInstanceArgs($arguments);
        } else {
            $rule = new $ruleClass();
        }
        $this->rules[] = $rule;
        return $this;
    }