createRule() public method

Factory method to construct a validator based on options that are used most of the times
public createRule ( string | callable $name, string | array $options = null, string $messageTemplate = null, string $label = null ) : Sirius\Validation\Rule\AbstractValidator
$name string | callable name of a validator class or a callable object/function
$options string | array validator options (an array, JSON string or QUERY string)
$messageTemplate string error message template
$label string label of the form input field or model attribute
return Sirius\Validation\Rule\AbstractValidator
Example #1
0
 /**
  * Remove validation rule
  *
  * @param mixed $name
  *            rule name or true if all rules should be deleted for that selector
  * @param mixed $options
  *            rule options, necessary for rules that depend on params for their ID
  *
  * @throws \InvalidArgumentException
  * @internal param string $selector data selector
  * @return self
  */
 public function remove($name = true, $options = null)
 {
     if ($name === true) {
         $this->rules = new RuleCollection();
         return $this;
     }
     $validator = $this->ruleFactory->createRule($name, $options);
     $this->rules->detach($validator);
     return $this;
 }