original_string: protected function createValidator($name)
      {
          $method = 'validation' . ucfirst($name);
          if (!$this->validationMethodExists($method)) {
              $message = sprintf('The %s::%s() validation method does not exists.', __CLASS__, $method);
              throw new RuntimeException($message);
          }
  
          $validator = new $this->_validatorClass;
          $validator = $this->$method($validator);
          if ($this instanceof EventDispatcherInterface) {
              $event = defined(self::class . '::BUILD_VALIDATOR_EVENT') ? self::BUILD_VALIDATOR_EVENT : 'Model.buildValidator';
              $this->dispatchEvent($event, compact('validator', 'name'));
          }
  
          if (!$validator instanceof Validator) {
              throw new RuntimeException(sprintf('The %s::%s() validation method must return an instance of %s.', __CLASS__, $method, Validator::class));
          }
  
          return $validator;
      }
code: protected function createValidator($name)
      {
          $method = 'validation' . ucfirst($name);
          if (!$this->validationMethodExists($method)) {
              $message = sprintf('The %s::%s() validation method does not exists.', __CLASS__, $method);
              throw new RuntimeException($message);
          }
  
          $validator = new $this->_validatorClass;
          $validator = $this->$method($validator);
          if ($this instanceof EventDispatcherInterface) {
              $event = defined(self::class . '::BUILD_VALIDATOR_EVENT') ? self::BUILD_VALIDATOR_EVENT : 'Model.buildValidator';
              $this->dispatchEvent($event, compact('validator', 'name'));
          }
  
          if (!$validator instanceof Validator) {
              throw new RuntimeException(sprintf('The %s::%s() validation method must return an instance of %s.', __CLASS__, $method, Validator::class));
          }
  
          return $validator;
      }
code_tokens: protected function createValidator ( $ name ) { $ method = 'validation' . ucfirst ( $ name ) ; if ( ! $ this -> validationMethodExists ( $ method ) ) { $ message = sprintf ( 'The %s::%s() validation method does not exists.' , __CLASS__ , $ method ) ; throw new RuntimeException ( $ message ) ; } $ validator = new $ this -> _validatorClass ; $ validator = $ this -> $ method ( $ validator ) ; if ( $ this instanceof EventDispatcherInterface ) { $ event = defined ( self :: class . '::BUILD_VALIDATOR_EVENT' ) ? self :: BUILD_VALIDATOR_EVENT : 'Model.buildValidator' ; $ this -> dispatchEvent ( $ event , compact ( 'validator' , 'name' ) ) ; } if ( ! $ validator instanceof Validator ) { throw new RuntimeException ( sprintf ( 'The %s::%s() validation method must return an instance of %s.' , __CLASS__ , $ method , Validator :: class ) ) ; } return $ validator ; }
docstring: Creates a validator using a custom method inside your class.
  
  This method is used only to build a new validator and it does not store
  it in your object. If you want to build and reuse validators,
  use getValidator() method instead.
  
  @param string $name The name of the validation set to create.
  @return \Cake\Validation\Validator
  @throws \RuntimeException
docstring_tokens: Creates a validator using a custom method inside your class .