original_string: protected function _addError($rule, $name, $options)
      {
          if (is_array($name)) {
              $options = $name;
              $name = null;
          }
  
          if (!($rule instanceof RuleInvoker)) {
              $rule = new RuleInvoker($rule, $name, $options);
          } else {
              $rule->setOptions($options)->setName($name);
          }
  
          return $rule;
      }
code: protected function _addError($rule, $name, $options)
      {
          if (is_array($name)) {
              $options = $name;
              $name = null;
          }
  
          if (!($rule instanceof RuleInvoker)) {
              $rule = new RuleInvoker($rule, $name, $options);
          } else {
              $rule->setOptions($options)->setName($name);
          }
  
          return $rule;
      }
code_tokens: protected function _addError ( $ rule , $ name , $ options ) { if ( is_array ( $ name ) ) { $ options = $ name ; $ name = null ; } if ( ! ( $ rule instanceof RuleInvoker ) ) { $ rule = new RuleInvoker ( $ rule , $ name , $ options ) ; } else { $ rule -> setOptions ( $ options ) -> setName ( $ name ) ; } return $ rule ; }
docstring: Utility method for decorating any callable so that if it returns false, the correct
  property in the entity is marked as invalid.
  
  @param callable $rule The rule to decorate
  @param string $name The alias for a rule.
  @param array $options The options containing the error message and field.
  @return callable
docstring_tokens: Utility method for decorating any callable so that if it returns false the correct property in the entity is marked as invalid .