protected function createChainableValidators(RespectValidator $class, array $rules): RespectValidator
    {
        // reset keys
        $rules = \array_values($rules);

        if (\count($rules) !== 0) {
            $chain = '';

            foreach ($rules as $rule) {
                if ($rules[0] === $rule) {
                    $chain .= $rule;
                } else {
                    $chain .= '.' . $rule;
                }
            }

            return \array_reduce(\explode('.', $chain), function (object $validator, string $method) {
                [$method, $parameters] = $this->parseStringRule($method);
                $method                = \str_replace(['!', '?'], '', $method);

                return $validator->{$method}(...$parameters);
            }, $class);
        }

        return $class;
    }
protected function createChainableValidators(RespectValidator $class, array $rules): RespectValidator
    {
        // reset keys
        $rules = \array_values($rules);

        if (\count($rules) !== 0) {
            $chain = '';

            foreach ($rules as $rule) {
                if ($rules[0] === $rule) {
                    $chain .= $rule;
                } else {
                    $chain .= '.' . $rule;
                }
            }

            return \array_reduce(\explode('.', $chain), function (object $validator, string $method) {
                [$method, $parameters] = $this->parseStringRule($method);
                $method                = \str_replace(['!', '?'], '', $method);

                return $validator->{$method}(...$parameters);
            }, $class);
        }

        return $class;
    }
protected function createChainableValidators ( RespectValidator $ class , array $ rules ) : RespectValidator { // reset keys $ rules = \ array_values ( $ rules ) ; if ( \ count ( $ rules ) !== 0 ) { $ chain = '' ; foreach ( $ rules as $ rule ) { if ( $ rules [ 0 ] === $ rule ) { $ chain .= $ rule ; } else { $ chain .= '.' . $ rule ; } } return \ array_reduce ( \ explode ( '.' , $ chain ) , function ( object $ validator , string $ method ) { [ $ method , $ parameters ] = $ this -> parseStringRule ( $ method ) ; $ method = \ str_replace ( [ '!' , '?' ] , '' , $ method ) ; return $ validator -> { $ method } ( ... $ parameters ) ; } , $ class ) ; } return $ class ; }
Chain validator to a chained validator object.

@param \Respect\Validation\Validator $class
@param array                         $rules

@return \Respect\Validation\Validator
Chain validator to a chained validator object .