src/AbstractModel.php
protected function performValidate($key, &$value)
    {
        if (!$filter = $this->_schema['filter'][$key])
            return true;

        $validation = Validation::instance();
        $moe = Base::instance();
        $field = $this->_properties['fields'][$key];
        foreach ($filter as $func => $param) {
            if (is_numeric($func)) {
                $func = $param;
                $args = array();
            } else
                $args = [$param];

            $function = $func;
            if (method_exists($validation, $func))
                $func = array($validation, $func);
            elseif (method_exists($this, $func) ||
                preg_match('/^('.self::Magic.')/', $func))
                $func = array($this, $func);
            elseif (method_exists($moe, $func))
                $func = array($moe, $func);

            array_unshift($args, $value);
            if (false === $result = $moe->call($func, $args)) {
                $this->_messages[] = $validation->message($function, $field, $value, $param);
                return false;
            } else
                is_bool($result) || $value = $result;
        }

        return true;
    }
protected function performValidate($key, &$value)
    {
        if (!$filter = $this->_schema['filter'][$key])
            return true;

        $validation = Validation::instance();
        $moe = Base::instance();
        $field = $this->_properties['fields'][$key];
        foreach ($filter as $func => $param) {
            if (is_numeric($func)) {
                $func = $param;
                $args = array();
            } else
                $args = [$param];

            $function = $func;
            if (method_exists($validation, $func))
                $func = array($validation, $func);
            elseif (method_exists($this, $func) ||
                preg_match('/^('.self::Magic.')/', $func))
                $func = array($this, $func);
            elseif (method_exists($moe, $func))
                $func = array($moe, $func);

            array_unshift($args, $value);
            if (false === $result = $moe->call($func, $args)) {
                $this->_messages[] = $validation->message($function, $field, $value, $param);
                return false;
            } else
                is_bool($result) || $value = $result;
        }

        return true;
    }
protected function performValidate ( $ key , & $ value ) { if ( ! $ filter = $ this -> _schema [ 'filter' ] [ $ key ] ) return true ; $ validation = Validation :: instance ( ) ; $ moe = Base :: instance ( ) ; $ field = $ this -> _properties [ 'fields' ] [ $ key ] ; foreach ( $ filter as $ func => $ param ) { if ( is_numeric ( $ func ) ) { $ func = $ param ; $ args = array ( ) ; } else $ args = [ $ param ] ; $ function = $ func ; if ( method_exists ( $ validation , $ func ) ) $ func = array ( $ validation , $ func ) ; elseif ( method_exists ( $ this , $ func ) || preg_match ( '/^(' . self :: Magic . ')/' , $ func ) ) $ func = array ( $ this , $ func ) ; elseif ( method_exists ( $ moe , $ func ) ) $ func = array ( $ moe , $ func ) ; array_unshift ( $ args , $ value ) ; if ( false === $ result = $ moe -> call ( $ func , $ args ) ) { $ this -> _messages [ ] = $ validation -> message ( $ function , $ field , $ value , $ param ) ; return false ; } else is_bool ( $ result ) || $ value = $ result ; } return true ; }
Perform validation
We can use method in Base class or any method with full name call but
you need to define a message to override default message
Be aware when use a method
Perform validation We can use method in Base class or any method with full name call but you need to define a message to override default message Be aware when use a method