src/Request.php
public function execute()
    {
        if ( ! $this->external)
        {
            Base::getLog()->debug(__METHOD__ . ' execute internal request');
            $processed = Request::process($this, $this->routes);

            if ($processed)
            {
                // 保存匹配到的路由
                $this->route = Arr::get($processed, 'route');
                $params = Arr::get($processed, 'params');

                // 是否为外部链接
                $this->external = $this->route->isExternal();

                // 控制器放在子目录中的情况
                if (isset($params['directory']))
                {
                    $this->directory = $params['directory'];
                }

                // 附加上命名空间
                if (isset($params['namespace']))
                {
                    $this->directory = $params['namespace'];
                }

                // 命名空间处理
                if ( ! $this->directory)
                {
                    $this->directory = Route::$defaultNamespace;
                }

                // 修正命名空间
                if (false === strpos($this->directory, '\\'))
                {
                    $this->directory = Route::$defaultNamespace . $this->directory . '\\';
                }

                // 保存控制器
                $this->controller = Arr::get($params, 'controller');

                // 保存动作
                $this->action = Arr::get($params, 'action', Route::$defaultAction);

                // 清理保留字段
                foreach ($this->persistRouteParams as $name)
                {
                    unset($params[$name]);
                }

                $this->_params = $params;

                Base::getLog()->debug(__METHOD__ . ' execute info', [
                    'directory'  => $this->directory,
                    'controller' => $this->controller,
                    'action'     => $this->action,
                    'params'     => $this->_params,
                ]);
            }
            else
            {
                Base::getLog()->debug(__METHOD__ . ' not route matched');
            }
        }

        if ( ! $this->route instanceof Entry)
        {
            $e = HttpException::factory(Http::NOT_FOUND, 'Unable to find a route to match the URI: :uri', [
                ':uri' => $this->uri,
            ]);
            $e->request($this);

            throw $e;
        }

        if ( ! $this->client instanceof RequestClient)
        {
            throw new RequestException('Unable to execute :uri without a RequestClient', [
                ':uri' => $this->uri,
            ]);
        }

        return $this->client->execute($this);
    }
public function execute()
    {
        if ( ! $this->external)
        {
            Base::getLog()->debug(__METHOD__ . ' execute internal request');
            $processed = Request::process($this, $this->routes);

            if ($processed)
            {
                // 保存匹配到的路由
                $this->route = Arr::get($processed, 'route');
                $params = Arr::get($processed, 'params');

                // 是否为外部链接
                $this->external = $this->route->isExternal();

                // 控制器放在子目录中的情况
                if (isset($params['directory']))
                {
                    $this->directory = $params['directory'];
                }

                // 附加上命名空间
                if (isset($params['namespace']))
                {
                    $this->directory = $params['namespace'];
                }

                // 命名空间处理
                if ( ! $this->directory)
                {
                    $this->directory = Route::$defaultNamespace;
                }

                // 修正命名空间
                if (false === strpos($this->directory, '\\'))
                {
                    $this->directory = Route::$defaultNamespace . $this->directory . '\\';
                }

                // 保存控制器
                $this->controller = Arr::get($params, 'controller');

                // 保存动作
                $this->action = Arr::get($params, 'action', Route::$defaultAction);

                // 清理保留字段
                foreach ($this->persistRouteParams as $name)
                {
                    unset($params[$name]);
                }

                $this->_params = $params;

                Base::getLog()->debug(__METHOD__ . ' execute info', [
                    'directory'  => $this->directory,
                    'controller' => $this->controller,
                    'action'     => $this->action,
                    'params'     => $this->_params,
                ]);
            }
            else
            {
                Base::getLog()->debug(__METHOD__ . ' not route matched');
            }
        }

        if ( ! $this->route instanceof Entry)
        {
            $e = HttpException::factory(Http::NOT_FOUND, 'Unable to find a route to match the URI: :uri', [
                ':uri' => $this->uri,
            ]);
            $e->request($this);

            throw $e;
        }

        if ( ! $this->client instanceof RequestClient)
        {
            throw new RequestException('Unable to execute :uri without a RequestClient', [
                ':uri' => $this->uri,
            ]);
        }

        return $this->client->execute($this);
    }
执行请求

@return Response
@throws HttpException
@throws ClientRecursionException
@throws RequestException