Respect\Validation\Validator::__callStatic PHP Method

__callStatic() public static method

public static __callStatic ( string $ruleName, array $arguments ) : Validator
$ruleName string
$arguments array
return Validator
    public static function __callStatic($ruleName, $arguments)
    {
        if ('allOf' === $ruleName) {
            return static::buildRule($ruleName, $arguments);
        }
        $validator = new static();
        return $validator->__call($ruleName, $arguments);
    }

Usage Example

Example #1
0
 private function getRule($input)
 {
     if (!isset($input[$this->comparedKey])) {
         throw $this->reportError($this->comparedKey);
     }
     if (!isset($input[$this->baseKey])) {
         throw $this->reportError($this->baseKey);
     }
     try {
         $rule = Validator::__callStatic($this->ruleName, [$input[$this->baseKey]]);
         $rule->setName($this->comparedKey);
     } catch (ComponentException $exception) {
         throw $this->reportError($input, ['component' => true]);
     }
     return $rule;
 }