1 | <?php |
||
18 | class ProfilePlugin implements Plugin |
||
19 | { |
||
20 | /** |
||
21 | * @var Plugin |
||
22 | */ |
||
23 | private $plugin; |
||
24 | |||
25 | /** |
||
26 | * @var Collector |
||
27 | */ |
||
28 | private $collector; |
||
29 | |||
30 | /** |
||
31 | * @var Formatter |
||
32 | */ |
||
33 | private $formatter; |
||
34 | |||
35 | /** |
||
36 | * @param Plugin $plugin |
||
37 | * @param Collector $collector |
||
38 | * @param Formatter $formatter |
||
39 | */ |
||
40 | 9 | public function __construct(Plugin $plugin, Collector $collector, Formatter $formatter) |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 8 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
|
91 | |||
92 | /** |
||
93 | * @param RequestInterface $request |
||
94 | * @param Profile $profile |
||
95 | * @param Exception $exception |
||
96 | * @param Stack $stack |
||
97 | */ |
||
98 | 2 | private function onException( |
|
108 | |||
109 | /** |
||
110 | * @param RequestInterface $request |
||
111 | * @param Profile $profile |
||
112 | */ |
||
113 | 7 | private function onOutgoingRequest(RequestInterface $request, Profile $profile) |
|
117 | |||
118 | /** |
||
119 | * @param ResponseInterface $response |
||
120 | * @param Profile $profile |
||
121 | * @param RequestInterface $request |
||
122 | * @param Stack $stack |
||
123 | */ |
||
124 | 6 | private function onOutgoingResponse(ResponseInterface $response, Profile $profile, RequestInterface $request, Stack $stack = null) |
|
129 | |||
130 | /** |
||
131 | * Collect request information when not already done by the HTTP client. This happens when using the CachePlugin |
||
132 | * and the cache is hit without re-validation. |
||
133 | * |
||
134 | * @param RequestInterface $request |
||
135 | * @param Stack|null $stack |
||
136 | */ |
||
137 | 8 | private function collectRequestInformation(RequestInterface $request, Stack $stack = null) |
|
162 | } |
||
163 |