private function createEachRule($rule, $validator = null)
    {
        unset($rule['attributes']);
        if (isset($rule['validator'])) {
            array_unshift($rule, "'{$rule['validator']}'");
            unset($rule['validator']);
        } elseif ($validator !== null) {
            array_unshift($rule, "'$validator'");
        }
        $result = [
            'validator' => 'each',
            'rule' => $rule,
            'attributes' => [],
        ];
        foreach (['on', 'except'] as $param) {
            if (isset($rule[$param])) {
                $result[$param] = $result['rule'][$param];
                unset($result['rule'][$param]);
            }
        }
        return $result;
    }
private function createEachRule($rule, $validator = null)
    {
        unset($rule['attributes']);
        if (isset($rule['validator'])) {
            array_unshift($rule, "'{$rule['validator']}'");
            unset($rule['validator']);
        } elseif ($validator !== null) {
            array_unshift($rule, "'$validator'");
        }
        $result = [
            'validator' => 'each',
            'rule' => $rule,
            'attributes' => [],
        ];
        foreach (['on', 'except'] as $param) {
            if (isset($rule[$param])) {
                $result[$param] = $result['rule'][$param];
                unset($result['rule'][$param]);
            }
        }
        return $result;
    }
private function createEachRule ( $ rule , $ validator = null ) { unset ( $ rule [ 'attributes' ] ) ; if ( isset ( $ rule [ 'validator' ] ) ) { array_unshift ( $ rule , "'{$rule['validator']}'" ) ; unset ( $ rule [ 'validator' ] ) ; } elseif ( $ validator !== null ) { array_unshift ( $ rule , "'$validator'" ) ; } $ result = [ 'validator' => 'each' , 'rule' => $ rule , 'attributes' => [ ] , ] ; foreach ( [ 'on' , 'except' ] as $ param ) { if ( isset ( $ rule [ $ param ] ) ) { $ result [ $ param ] = $ result [ 'rule' ] [ $ param ] ; unset ( $ result [ 'rule' ] [ $ param ] ) ; } } return $ result ; }
Creates an 'each' rule from a normal validation rule.
@param array $rule
@param string $validator
@return array
Creates an each rule from a normal validation rule .