original_string: public function init()
      {
          parent::init();
          $that = $this;
  
          if ($this->owner instanceof Controller_Validator) {
              $this->owner->addHook('extraRules', array($this, 'extraRules'));
  
              return;  // no source, simply extend rules.
          }
  
          if ((
              $this->owner instanceof \Model ||
              $this->owner instanceof \Form
  
          ) && !$this->owner->hasMethod('is')) {
              $this->source = $this->owner; // must support set/get interface
              $this->owner->validator = $this;
  
              $this->source->addMethod('is', function ($m) use ($that) {
                  $args = func_get_args();
                  array_shift($args);
  
                  call_user_func_array(array($that, 'is'), $args);
                  $that->on('beforeSave', null, true);
  
                  return $m;
              });
          }
      }
code: public function init()
      {
          parent::init();
          $that = $this;
  
          if ($this->owner instanceof Controller_Validator) {
              $this->owner->addHook('extraRules', array($this, 'extraRules'));
  
              return;  // no source, simply extend rules.
          }
  
          if ((
              $this->owner instanceof \Model ||
              $this->owner instanceof \Form
  
          ) && !$this->owner->hasMethod('is')) {
              $this->source = $this->owner; // must support set/get interface
              $this->owner->validator = $this;
  
              $this->source->addMethod('is', function ($m) use ($that) {
                  $args = func_get_args();
                  array_shift($args);
  
                  call_user_func_array(array($that, 'is'), $args);
                  $that->on('beforeSave', null, true);
  
                  return $m;
              });
          }
      }
code_tokens: public function init ( ) { parent :: init ( ) ; $ that = $ this ; if ( $ this -> owner instanceof Controller_Validator ) { $ this -> owner -> addHook ( 'extraRules' , array ( $ this , 'extraRules' ) ) ; return ; // no source, simply extend rules. } if ( ( $ this -> owner instanceof \ Model || $ this -> owner instanceof \ Form ) && ! $ this -> owner -> hasMethod ( 'is' ) ) { $ this -> source = $ this -> owner ; // must support set/get interface $ this -> owner -> validator = $ this ; $ this -> source -> addMethod ( 'is' , function ( $ m ) use ( $ that ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; call_user_func_array ( array ( $ that , 'is' ) , $ args ) ; $ that -> on ( 'beforeSave' , null , true ) ; return $ m ; } ) ; } }
docstring: {{{ Initialization method
docstring_tokens: {{{ Initialization method