protected function matchValidators(ServerRequestInterface $request, $path, array &$parameters = array())
    {
        foreach($this->properties['validators'] as $validation)
        {
            if(is_string($validation)) {
                if(!isset(static::$classCaches[$validation])) {
                    /** @var Validator $validationObj */
                    $validationObj = new $validation;

                    if(!($validationObj instanceof Validator))
                        throw new InvalidArgumentException('The [' . $validation . '] validator must be type of [' . Validator::class . '].');
                } else {
                    $validationObj = static::$classCaches[$validation];
                }

                $flag = $validationObj->validate($parameters, $this, $request, $path);
            }
            else if(is_object($validation) && ($validation instanceof \Closure)) {
                $flag = $validation($parameters, $this, $request, $path);
            } else {
                throw new InvalidArgumentException('The validator must be type of [' . Validator::class . '] or [' . \Closure::class . ']');
            }

            if(!$flag || $flag === false)
                return false;
        }

        return true;
    }
protected function matchValidators(ServerRequestInterface $request, $path, array &$parameters = array())
    {
        foreach($this->properties['validators'] as $validation)
        {
            if(is_string($validation)) {
                if(!isset(static::$classCaches[$validation])) {
                    /** @var Validator $validationObj */
                    $validationObj = new $validation;

                    if(!($validationObj instanceof Validator))
                        throw new InvalidArgumentException('The [' . $validation . '] validator must be type of [' . Validator::class . '].');
                } else {
                    $validationObj = static::$classCaches[$validation];
                }

                $flag = $validationObj->validate($parameters, $this, $request, $path);
            }
            else if(is_object($validation) && ($validation instanceof \Closure)) {
                $flag = $validation($parameters, $this, $request, $path);
            } else {
                throw new InvalidArgumentException('The validator must be type of [' . Validator::class . '] or [' . \Closure::class . ']');
            }

            if(!$flag || $flag === false)
                return false;
        }

        return true;
    }
protected function matchValidators ( ServerRequestInterface $ request , $ path , array & $ parameters = array ( ) ) { foreach ( $ this -> properties [ 'validators' ] as $ validation ) { if ( is_string ( $ validation ) ) { if ( ! isset ( static :: $ classCaches [ $ validation ] ) ) { /** @var Validator $validationObj */ $ validationObj = new $ validation ; if ( ! ( $ validationObj instanceof Validator ) ) throw new InvalidArgumentException ( 'The [' . $ validation . '] validator must be type of [' . Validator :: class . '].' ) ; } else { $ validationObj = static :: $ classCaches [ $ validation ] ; } $ flag = $ validationObj -> validate ( $ parameters , $ this , $ request , $ path ) ; } else if ( is_object ( $ validation ) && ( $ validation instanceof \ Closure ) ) { $ flag = $ validation ( $ parameters , $ this , $ request , $ path ) ; } else { throw new InvalidArgumentException ( 'The validator must be type of [' . Validator :: class . '] or [' . \ Closure :: class . ']' ) ; } if ( ! $ flag || $ flag === false ) return false ; } return true ; }
Do a custom validation matching
@param ServerRequestInterface $request
@param $path
@param array $parameters
@return bool
@throws InvalidArgumentException
Do a custom validation matching