追加某个字段的验证规则
@access public
@param  string|array $field 字段名
@param  mixed        $rule  验证规则
@return $this
962873
public function append( $field, $rule = null )
	{
		if( is_array( $field ) ){
			foreach( $field as $key => $rule ){
				$this->append( $key, $rule );
			}
		} else{
			if( is_string( $rule ) ){
				$rule = explode( '|', $rule );
			}
			$this->append[$field] = $rule;
		}
		return $this;
	}
88565
public function allowField($field)
    {
        if (is_string($field)) {
            $field = explode(',', $field);
        }

        $this->field = $field;

        return $this;
    }
978518
public function onUpdate(string $rule = self::NO_ACTION): AbstractForeignKey
    {
        $this->updateRule = strtoupper($rule);

        return $this;
    }
313148
public function getRuleValidator($field, $rule)
    {
        return isset($this->ruleValidators[$field][$rule]) ? $this->ruleValidators[$field][$rule] : null;
    }
1274152
public function addRules(array $rules) : ValidatorInterface
    {
        if (!is_array($rules) || empty($rules)) {
            throw new ValidatorException(sprintf('Validator::addRules() expect array of rules, %s given.', \gettype($rules)));
        }

        foreach ($rules as $field => $rule) {
            $this->addRule($field, $rule);
        }

        return $this;
    }
1142649
public function addMultiple($rules)
    {
        foreach ($rules as $singleRule) {
            // make sure the rule is an array (the parameters of subsequent calls);
            $singleRule = is_array($singleRule) ? $singleRule : array(
                $singleRule
            );
            call_user_func_array(
                array(
                    $this,
                    'add'
                ),
                $singleRule
            );
        }

        return $this;
    }
819241
private function compound($field, $rules)
    {
        $out = [];
        if (is_array($rules)) {
            foreach ($rules as $operator => $value) {
                $out[] = json_encode([$field => [$operator => $value]]);
            }

            return $out;
        } elseif (is_a($rules, MultiFullTextFilter::class)) {
            $out[] = (string)$rules;

            return $out;
        }
        $out[] = json_encode([$field => $rules]);

        return $out;
    }
318581
public function pushField(Field $field)
    {
        $field = $this->formatField($field);

        $this->fields->push($field);

        return $this;
    }
1012310
public function field(string $field) : self
    {
        $this->currentField = $field;
        $this->expr->field($field);

        return $this;
    }
1240180
public function addRule($rule, $route, $method = '*', $option = [], $pattern = [])
    {
        // 读取路由标识
        if (is_array($rule)) {
            $name = $rule[0];
            $rule = $rule[1];
        } elseif (is_string($route)) {
            $name = $route;
        } else {
            $name = null;
        }

        $method = strtolower($method);

        if ('/' === $rule || '' === $rule) {
            // 首页自动完整匹配
            $rule .= '$';
        }

        // 创建路由规则实例
        $ruleItem = new RuleItem($this->router, $this, $name, $rule, $route, $method, $option, $pattern);

        if (!empty($option['cross_domain'])) {
            $this->router->setCrossDomainRule($ruleItem, $method);
        }

        $this->addRuleItem($ruleItem, $method);

        return $ruleItem;
    }
1037055
public final function removeRule($field, $rule = null) {
		if ($rule == null) {
			unset($this->rules[ $field ]);
		} else {
			$idx = $this->ruleKeys[ $field ][ $rule ];
			unset($this->rules[ $field ][ $idx ]);
		}
	}
565308
public function addRule($field, $rule, $message, $options = array()) {
        if (empty($this->_fields[$field])) {
            throw new InvalidArgumentException(sprintf('Field %s does not exist', $field));
        }

        if (isset($this->_messages[$rule])) {
            $message = $message ?: $this->_messages[$rule];
        } else {
            $this->_messages[$rule] = $message;
        }

        $this->_rules[$field][$rule] = array(
            'message' => $message,
            'options' => (array) $options
        );

        return $this;
    }
1265354
public function addRule(RuleAbstract $rule)
    {
        // Check for allowed instances
        if ($rule instanceof RuleGroupableInterface) {
            $this->rules[] = $rule;
        } else {
            // Invalid rule instance, because only nested statements can be added to conditional group rules.
            $parentClassName = get_class($this);
            $childClassName = get_class($rule);
            $rule->setIsValid(false);
            $rule->addValidationError(
                "Rule instance of type '$childClassName' not allowed " .
                "in conditional group rule of type '$parentClassName'."
            );
            $this->rules[] = $rule;
        }

        return $this;
    }
739717
public function addRule( $rule )
    {
        if ( ! ( $rule instanceof RuleStructure ) )
        {
            $rule = new RuleStructure( $rule );
        }

        $this->rules[] = $rule;
        return $this;
    }
411919
public function rule($rule)
    {
        $this->rule = is_string($this->rule) ? explode('|', $this->rule) : $this->rule;
        $rule = is_string($rule) ? explode('|', $rule) : $rule;
        $this->rule = array_unique(array_merge($this->rule, $rule));
        if (in_array('required', $this->rule) && ! isset($this->no_star)) {
            $this->required = true;
        }

        return $this;
    }
1315979
public function addRule(Rule $rule)
    {
        $this->addReason($rule->getId(), array(
            'rule' => $rule,
            'job' => $rule->getJob(),
        ));
    }
833782
public function rule($field, $rules = [])
    {
        $defaults = [
            'message' => null,
            'required' => true,
            'skipEmpty' => false,
            'format' => 'any',
            'not' => false,
            'on' => null
        ];

        $rules = $rules ? (array) $rules : [];

        foreach ($rules as $name => $options) {
            if (is_numeric($name)) {
                $name = $options;
                $options = [];
            }
            if (is_string($options)) {
                $options = ['message' => $options];
            }
            $options += $defaults;
            $this->_rules[$field][$name] = $options;
        }
    }