src/Request/RequestClient.php
public function execute(Request $request)
    {
        // 防止一直循环
        if ($this->callbackDepth > $this->maxCallbackDepth)
        {
            throw new ClientRecursionException('Could not execute request to :uri - too many recursions after :depth requests', [
                ':uri'   => $request->uri,
                ':depth' => $this->callbackDepth - 1,
            ]);
        }

        $origResponse = $response = new Response([
            'protocol' => $request->protocol,
        ]);

        $response = $this->executeRequest($request, $response);

        foreach ($this->headerCallbacks as $header => $callback)
        {
            if ($response->headers($header))
            {
                $callbackResult = call_user_func($callback, $request, $response, $this);

                if ($callbackResult instanceof Request)
                {
                    $this->assignClientProperties($callbackResult->client);
                    $callbackResult
                        ->client
                        ->callbackDepth = $this->callbackDepth + 1;

                    $response = $callbackResult->execute();
                }
                elseif ($callbackResult instanceof Response)
                {
                    $response = $callbackResult;
                }

                if ($response !== $origResponse)
                {
                    break;
                }
            }
        }

        return $response;
    }
public function execute(Request $request)
    {
        // 防止一直循环
        if ($this->callbackDepth > $this->maxCallbackDepth)
        {
            throw new ClientRecursionException('Could not execute request to :uri - too many recursions after :depth requests', [
                ':uri'   => $request->uri,
                ':depth' => $this->callbackDepth - 1,
            ]);
        }

        $origResponse = $response = new Response([
            'protocol' => $request->protocol,
        ]);

        $response = $this->executeRequest($request, $response);

        foreach ($this->headerCallbacks as $header => $callback)
        {
            if ($response->headers($header))
            {
                $callbackResult = call_user_func($callback, $request, $response, $this);

                if ($callbackResult instanceof Request)
                {
                    $this->assignClientProperties($callbackResult->client);
                    $callbackResult
                        ->client
                        ->callbackDepth = $this->callbackDepth + 1;

                    $response = $callbackResult->execute();
                }
                elseif ($callbackResult instanceof Response)
                {
                    $response = $callbackResult;
                }

                if ($response !== $origResponse)
                {
                    break;
                }
            }
        }

        return $response;
    }
处理请求，根据路由中的信息，执行对应的控制器和动作

@param  Request $request
@return Response
@throws ClientRecursionException
@throws RequestException