Respect\Validation\Validator::buildRule PHP Method

buildRule() public static method

public static buildRule ( mixed $ruleSpec, array $arguments = [] ) : Respect\Validation\Validatable
$ruleSpec mixed
$arguments array
return Respect\Validation\Validatable
    public static function buildRule($ruleSpec, $arguments = [])
    {
        try {
            return static::getFactory()->rule($ruleSpec, $arguments);
        } catch (\Exception $exception) {
            throw new ComponentException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }

Usage Example

 public function addRule($validator, $arguments = array())
 {
     if (!$validator instanceof Validatable) {
         $this->appendRule(Validator::buildRule($validator, $arguments));
     } else {
         $this->appendRule($validator);
     }
     return $this;
 }
All Usage Examples Of Respect\Validation\Validator::buildRule