public function setRule($rule, $function, $message = '', $args = array())
    {
        if (!array_key_exists($rule, $this->rules)) {
            $this->rules[$rule] = TRUE;
            if (!array_key_exists($rule, $this->functions)) {
                if (!is_callable($function)) {
                    die('Invalid function for rule: ' . $rule);
                }
                $this->functions[$rule] = $function;
            }
            $this->arguments[$rule] = $args; // Specific arguments for rule

            $this->messages[$rule] = (empty($message)) ? $this->_getDefaultMessage($rule, $args) : $message;
        }
    }
public function setRule($rule, $function, $message = '', $args = array())
    {
        if (!array_key_exists($rule, $this->rules)) {
            $this->rules[$rule] = TRUE;
            if (!array_key_exists($rule, $this->functions)) {
                if (!is_callable($function)) {
                    die('Invalid function for rule: ' . $rule);
                }
                $this->functions[$rule] = $function;
            }
            $this->arguments[$rule] = $args; // Specific arguments for rule

            $this->messages[$rule] = (empty($message)) ? $this->_getDefaultMessage($rule, $args) : $message;
        }
    }
public function setRule ( $ rule , $ function , $ message = '' , $ args = array ( ) ) { if ( ! array_key_exists ( $ rule , $ this -> rules ) ) { $ this -> rules [ $ rule ] = TRUE ; if ( ! array_key_exists ( $ rule , $ this -> functions ) ) { if ( ! is_callable ( $ function ) ) { die ( 'Invalid function for rule: ' . $ rule ) ; } $ this -> functions [ $ rule ] = $ function ; } $ this -> arguments [ $ rule ] = $ args ; // Specific arguments for rule $ this -> messages [ $ rule ] = ( empty ( $ message ) ) ? $ this -> _getDefaultMessage ( $ rule , $ args ) : $ message ; } }
Set rule.

@param string $rule
@param closure $function
@param string $message
@param array $args
Set rule .