public function validateFor($context)
    {

        $this->errors = new Errors();

        // create camelized method name
        $methodResolved = ActionUtils::parseMethod($context);

        // check method exists
        if(!method_exists($this, $methodResolved))
            throw new Exception('Method ['.$methodResolved.'] does not exist on class ['.get_class($this).']');

        $this->preValidate();

        // if(LOG_ENABLE) System::log(self::$logType, 'Executing method ['.$methodResolved.']');

        $arr = array_slice(func_get_args(), 1);

        // CALL THE METHOD
        call_user_func_array(array($this, $methodResolved), $arr);

        $this->postValidate();

        return $this->errors;
    }
public function validateFor($context)
    {

        $this->errors = new Errors();

        // create camelized method name
        $methodResolved = ActionUtils::parseMethod($context);

        // check method exists
        if(!method_exists($this, $methodResolved))
            throw new Exception('Method ['.$methodResolved.'] does not exist on class ['.get_class($this).']');

        $this->preValidate();

        // if(LOG_ENABLE) System::log(self::$logType, 'Executing method ['.$methodResolved.']');

        $arr = array_slice(func_get_args(), 1);

        // CALL THE METHOD
        call_user_func_array(array($this, $methodResolved), $arr);

        $this->postValidate();

        return $this->errors;
    }
public function validateFor ( $ context ) { $ this -> errors = new Errors ( ) ; // create camelized method name $ methodResolved = ActionUtils :: parseMethod ( $ context ) ; // check method exists if ( ! method_exists ( $ this , $ methodResolved ) ) throw new Exception ( 'Method [' . $ methodResolved . '] does not exist on class [' . get_class ( $ this ) . ']' ) ; $ this -> preValidate ( ) ; // if(LOG_ENABLE) System::log(self::$logType, 'Executing method ['.$methodResolved.']'); $ arr = array_slice ( func_get_args ( ) , 1 ) ; // CALL THE METHOD call_user_func_array ( array ( $ this , $ methodResolved ) , $ arr ) ; $ this -> postValidate ( ) ; return $ this -> errors ; }
This method is called to perform validation

@param string $context        A string representing the name of the context
in which the validation occurs. For example: 'add', 'edit', 'delete', etc.
@param mixed  $arg, $arg, ... Using func_get_args() these arguments will be passed to the validator function
invoked by this function.

@return array an array of Errors (or empty array)
This method is called to perform validation