获取当前验证类型及规则
@access public
@param  mixed $key
@param  mixed $rule
@return array
550581
protected function getValidatorType( $key, $rule )
	{
		// 判断验证类型
		if( !is_numeric( $key ) ){
			return [$key, $rule, $key];
		}
		if( strpos( $rule, ':' ) ){
			list( $type, $rule ) = explode( ':', $rule, 2 );
			if( isset( $this->alias[$type] ) ){
				// 判断别名
				$type = $this->alias[$type];
			}
			$info = $type;
		} elseif( method_exists( $this, $rule ) ){
			$type = $rule;
			$info = $rule;
			$rule = '';
		} else{
			$type = 'is';
			$info = $rule;
		}
		return [$type, $rule, $info];
	}
360642
public function get_message($rule)
	{
		if ( ! array_key_exists($rule, $this->error_messages))
		{
			return false;
		}

		return $this->error_messages[$rule];
	}
1181399
protected function parseRule($rule)
	{
		$parameters = array();

		// The format for specifying validation rules and parameters follows an
		// easy {rule}:{parameters} formatting convention. For instance the
		// rule "Max:3" states that the value may only be three letters.
		if (strpos($rule, ':') !== false)
		{
			list($rule, $parameter) = explode(':', $rule, 2);

			$parameters = $this->parseParameters($rule, $parameter);
		}

		return array(studly_case($rule), $parameters);
	}
827692
public function parse($rules): Rule\Set
    {
        $isArray = is_array($rules);
        $isAssoc = $isArray && self::isAssociative($rules);
        $set = null;
        if (is_string($rules) || is_object($rules) || $isAssoc) {
            $set = $this->getRule($rules);
        } elseif ($isArray) {
            foreach ($rules as $v) {
                $toAdd = $this->getRule($v);
                $set = $set === null ? $toAdd : $set->merge($toAdd);
            }
        }
        return $set ?? new Rule\Set();
    }
76672
public function getRule($rule, $domain = null)
    {
        return isset($this->rule[$domain][$rule]) ? $this->rule[$domain][$rule] : [];
    }
458989
public function converterRule($rule) {
        if (!is_array($rule)) {
            $rule = explode('|', $rule);
        }
        $rules = [];
        $message = null;
        foreach ($rule as $key => $item) {
            if (!is_integer($key)) {
                $rules[$key] = $item;
                continue;
            }
            if (is_callable($item)) {
                $rules[] = $item;
            }
            if (!is_string($item) || strpos($item, ':') === false) {
                $rules[$item] = [];
                continue;
            }
            list($key, $val) = explode(':', $item, 2);
            if ($key == 'message') {
                $message = $val;
                continue;
            }
            $rules[$key] = explode(',', $val);
        }
        return compact('rules', 'message');
    }
424942
private function actionLog($rule){

        //是否需要打开 行为日志检查
        if($this->log === false){
            return true;
        }

        $logMenu    = Cache('logMenu');
        if(empty($logMenu)){    //缓存日志24小时
            $logMenu    = Menu::actionLogMenu();
            Cache('logMenu',$logMenu,86400);
        }

        $menu       =   isset($logMenu[$rule])?$logMenu[$rule]:'';

        $log        = [];
        if(empty($menu)){
            return true;
        }

        //子集行为日志菜单匹配
        if(isset($menu['child'])){
           foreach($menu['child'] as $v){
             if(!empty($v['rule_param'])){
                 $condition = '';
                 $command   = preg_replace('/\{(\w*?)\}/', '$this->param[\'\\1\']', $v['rule_param']);
                 @(eval('$condition=(' . $command . ');'));
                 if ($condition and $v['request'] == $this->request->method()) {
                     $log = $v;
                 }
             }
           }
        }

        //父集行为日志菜单匹配
        if(empty($log)){
            if($menu['request'] == $this->request->method()){
                $log    = $menu;
            }
        }

        if(!empty($log)){
            return self::createLog($log['log_rule'],$log['name']);
        }

        return true;
    }
1042620
public function parseGroupRule($rule)
    {
        $origin = $this->router->getGroup();
        $this->router->setGroup($this);

        if ($rule instanceof \Closure) {
            Container::getInstance()->invokeFunction($rule);
        } elseif (is_array($rule)) {
            $this->addRules($rule);
        } elseif (is_string($rule) && $rule) {
            $this->router->bind($rule, $this->domain);
        }

        $this->router->setGroup($origin);
    }
277873
public static function parseDotRule($rule)
    {
        $result = preg_split('#(?<!\\\)\.#', $rule);
        array_walk($result, function(&$value, $key){
            if(false !== strpos($value,'\.'))
            {
                $value = str_replace('\.', '.', $value);
            }
        });
        return $result;
    }
699514
private function parseRule($rule)
	{
		if (!is_array($rule) || (count($rule) < 2)) {
			throw new ValidatorException('Invalid declaration of validation rule');
		}

		is_array($rule[0]) || $rule[0] = [$rule[0]];

		if (!is_string($rule[1])) {
			throw new ValidatorException('Validator name: Expected string');
		}

		if (isset($rule[2])) {
			if(!is_array($rule[2])) {
				throw new ValidatorException('Validator options: Expected array');
			}
		} else {
			$rule[2] = [];
		}
		$rule[2] = new ArrayWrapper($rule[2]);

		return $rule;
	}
972708
private function parseRule($rule, $input, $key)
    {
        $ruleExp = explode(':', $rule);
        if (count($ruleExp) > 1) {
            switch ($ruleExp[0]) {
                case 'match':
                $this->_errors[$key][] = $this->_parser->match($input, $key, $ruleExp[1], $this->_lang['match']);
                break;
                case 'min':
                $this->_errors[$key][] = $this->_parser->min($input, $key, $ruleExp[1], $this->_lang['min']);
                break;
                case 'max':
                $this->_errors[$key][] = $this->_parser->max($input, $key, $ruleExp[1], $this->_lang['max']);
                break;
                case 'from':
                $this->_errors[$key][] = $this->_parser->from($input, $key, $rule, $this->_lang['from']);
                break;
            }
        } else {
            switch ($rule) {
                case 'required':
                $this->_errors[$key][] = $this->_parser->required($input, $key, $this->_lang['required']);
                break;
                case 'email':
                $this->_errors[$key][] = $this->_parser->email($input, $key, $this->_lang['email']);
                break;
                case 'url':
                $this->_errors[$key][] = $this->_parser->url($input, $key, $this->_lang['url']);
                break;
            }
        }
    }
941958
protected function onInvalidEventAttributeValidate($key, $check = [], $rule = NULL)
    {
        $this->validate[] = $rule ?: $key;

        return $this->required()->onInvalidEventCustomValidity($key, $check);
    }
868822
protected function getRule($attribute, $rules)
	{
		if ( ! array_key_exists($attribute, $this->rules))
		{
			return;
		}

		$rules = (array) $rules;

		foreach ($this->rules[$attribute] as $rule)
		{
			list($rule, $parameters) = $this->parseRule($rule);

			if (in_array($rule, $rules)) return [$rule, $parameters];
		}
	}
1131853
protected function proof_result( $rule, $key, $result )
	{	
		if ( $result === false )
		{
			$this->failed[$key][] = $rule;
		}

		if ( $this->success === true )
		{
			return $this->success = $result;
		}

		return $result;
	}
1346125
protected function getValueFromRule($rule)
    {
        $value = $this->getRuleValue($rule);

        if (isset($this->operators[$rule->operator]['accept_values'])
            && $this->operators[$rule->operator]['accept_values'] === false) {
            return $this->operatorValueWhenNotAcceptingOne($rule);
        }

        return $this->getCorrectValue($rule->operator, $rule, $value);
    }
376900
protected function _validateData($rule, $key, $data)
    {
        if (
            (is_callable($rule) && call_user_func_array($rule, [$key, $data, $this]))
            || @preg_match($rule, $data)
        ) {
            return true;
        }

        if ($rule instanceof Closure) {
            $reflection = new ReflectionFunction($rule);
            $rule       = $reflection->__toString();
        }

        $this->_errorsList[] = [
            'message'   => 'validation_mismatch',
            'key'       => $key,
            'data'      => $data,
            'rule'      => $rule,
        ];
        $this->_hasErrors = true;

        return false;
    }
1360820
public function getRule($ruleName)
    {
        return isset($this->rules[$ruleName]) ? $this->rules[$ruleName] : null;
    }