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;
    }