行为日志检查
@access public
@param  string          $rule        日志规则
@return array
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;
    }
828765
public function get_error_message($rule)
	{
		if (isset($this->error_messages[$rule]))
		{
			return $this->error_messages[$rule];
		}
		elseif (isset($this->error_messages[0]))
		{
			return $this->error_messages[0];
		}

		return null;
	}
542401
public function getRules($rules): \Generator
    {
        foreach ($this->parser->split($rules) as $id => $rule) {
            if (empty($id) || $rule instanceof \Closure) {
                yield new CallableRule($rule);
                continue;
            }

            // fetch from cache
            if (isset($this->rules[$id])) {
                yield $this->rules[$id];
                continue;
            }

            $function = $this->parser->parseCheck($rule);
            $conditions = $this->parser->parseConditions($rule);

            $check = $this->makeRule(
                $this->config->mapFunction($function),
                $rule
            );

            yield $this->rules[$id] = $check->withConditions($this->makeConditions($conditions));
        }
    }
927714
protected function getRuleArgs($rule)
    {
        if (($arg = substr(strstr($rule, ':'), 1)) !== false) {
            /* Si l'argument fait référence à un autre champ. */
            if ($arg[ 0 ] == '@') {
                $keyArg = substr($arg, 1);
                $arg    = $this->inputs[ $keyArg ];
            }
        }

        return $arg;
    }
594501
protected function compileTranspose(array $rule)
    {
        return array(
            'regexp' => '([' .
                preg_quote($this->compileCharacter($rule['data']['srcStart'])) . '-' .
                preg_quote($this->compileCharacter($rule['data']['srcEnd'])) .
                '])us',
            'callback' => $this->getTransposeClosure($rule['data']['op'], $rule['data']['dest']),
        );
    }
580502
public function loadRuleTargetsData(Rule $rule): array
    {
        $query = $this->getTargetSelectQuery();
        $query->where(
            $query->expr()->eq('rule_id', ':rule_id')
        )
        ->setParameter('rule_id', $rule->id, Type::INTEGER)
        ->orderBy('id', 'ASC');

        $this->applyStatusCondition($query, $rule->status);

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
895570
public function in($rule) {
        $this->check_role = 'in';
        if (!is_array($rule)) {
            $rule = explode(',', $rule);
        }
        $this->rule = '[' . explode(',', $rule) . ']';
        $result = in_array($this->value, $rule);
        $this->checkResult($result);
        return $this;
    }
875886
public function execute(array $rule, $groupOperator = 'OR')
    {
        $queryBuilder = $this->grid->getQueryBuilder();
        $date = \DateTime::createFromFormat($this->grid->getDatePickerPhpFormat(), $rule['data']);

        $queryBuilder
                ->andWhere(
                        $queryBuilder->expr()->gte($this->column->getFieldIndex(), ":{$this->column->getFieldName()}_1"))
                ->setParameter("{$this->column->getFieldName()}_1", $date->format('Y-m-d 00:00:00'));

        $queryBuilder
                ->andWhere(
                        $queryBuilder->expr()->lte($this->column->getFieldIndex(), ":{$this->column->getFieldName()}_2"))
                ->setParameter("{$this->column->getFieldName()}_2", $date->format('Y-m-d 23:59:59'));
    }
291188
protected function compileReplace(array $rule)
    {
        return array(
            'regexp' => '([' .
                preg_quote($this->compileCharacter($rule['data']['srcStart'])) . '-' .
                preg_quote($this->compileCharacter($rule['data']['srcEnd'])) .
                '])us',
            'callback' => $this->compileTargetCharacter($rule['data']['dest']),
        );
    }
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');
    }
488942
private static function isRule($rule) {

		if(false === is_string($rule)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($rule)), E_USER_ERROR);
		}

		$class = static :: getRuleClass($rule);

		return true === class_exists($class);
	}
72809
private function getRules($rules)
    {
        $rules = [];

        foreach($rules as $rule)
        {
            $rules[] = explode('/', $rule);
        }

        return $rules;
    }
277043
private function checkBasicRule($rule, $path)
    {
        $rule = $this->prepareRegexRule($this->encode_url($rule));
        // change @ to \@
        $escaped = strtr($rule, array('@' => '\@'));
        // match result
        if (preg_match('@' . $escaped . '@', $path)) {
	        $this->log[] = 'Rule match: Path';
	        return true;
        }
        return false;
    }
995712
public function find($rule){

            $r = [];

            foreach($this->data as $k=>$v){
                if($rule($this->{$k})){
                    $r[] = $this->{$k};
                }
            }

            return $r;

        }
303728
protected function ruleToArray($rule)
    {
        if ($rule instanceof ConstraintGroup || $rule instanceof Constraint) {
            return $this->constraintToArray($rule);
        }

        return $this->parseConstraint($rule);
    }
442828
public function before($rule) {
        $this->check_role = 'before';
        $this->rule = $rule;
        $result = strtotime($this->value) <= strtotime($rule);
        $this->checkResult($result);
        return $this;
    }
472246
protected function removeRule($rule)
    {
        if (!is_string($this->rules)) {
            return;
        }

        $pattern = "/{$rule}[^\|]?(\||$)/";
        $this->rules = preg_replace($pattern, '', $this->rules, -1);
    }