protected function doExecute() { $params = array('url' => $this->url); if ($this->group !== '') { $params['group'] = $this->group; } else { $params['group'] = null; } $rules = Rule::find(array($params)); if ($rules) { $contextMap = array(RuleConditionExpressionOperand::CONTEXT_TYPE_REQUEST => $_REQUEST, RuleConditionExpressionOperand::CONTEXT_TYPE_GET => $_GET, RuleConditionExpressionOperand::CONTEXT_TYPE_POST => $_POST, RuleConditionExpressionOperand::CONTEXT_TYPE_HEADER => HttpUtils::getHttpHeaders(), RuleConditionExpressionOperand::CONTEXT_TYPE_COOKIE => $_COOKIE); $matcher = new RuleResponseMatcher(); foreach ($rules as $rule) { $res = $matcher->match($rule, $contextMap); if (isset($res)) { if (is_array($res) || is_object($res)) { $this->setReturnType(self::RETURN_TYPE_JSON); return $this->success($rule->res); } else { return $res; } } } } $this->setReturnType(self::RETURN_TYPE_JSON); return $this->error(1, 'can\'t match any url for [' . $this->url . ']'); }