1 | <?php |
||
22 | class ProfileClient implements HttpClient, HttpAsyncClient |
||
23 | { |
||
24 | /** |
||
25 | * @var HttpClient|HttpAsyncClient |
||
26 | */ |
||
27 | private $client; |
||
28 | |||
29 | /** |
||
30 | * @var Collector |
||
31 | */ |
||
32 | private $collector; |
||
33 | |||
34 | /** |
||
35 | * @var Formatter |
||
36 | */ |
||
37 | private $formatter; |
||
38 | |||
39 | /** |
||
40 | * @var Stopwatch |
||
41 | */ |
||
42 | private $stopwatch; |
||
43 | |||
44 | /** |
||
45 | * @param HttpClient|HttpAsyncClient $client The client to profile. Client must implement both HttpClient and |
||
46 | * HttpAsyncClient interfaces. |
||
47 | * @param Collector $collector |
||
48 | * @param Formatter $formatter |
||
49 | * @param Stopwatch $stopwatch |
||
50 | */ |
||
51 | 4 | public function __construct($client, Collector $collector, Formatter $formatter, Stopwatch $stopwatch) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function sendAsyncRequest(RequestInterface $request) |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function sendRequest(RequestInterface $request) |
||
114 | |||
115 | /** |
||
116 | * @param RequestInterface $request |
||
117 | * @param Stack|null $stack |
||
118 | */ |
||
119 | private function collectRequestInformations(RequestInterface $request, Stack $stack = null) |
||
131 | |||
132 | /** |
||
133 | * @param ResponseInterface $response |
||
134 | * @param StopwatchEvent $event |
||
135 | * @param Stack|null $stack |
||
136 | */ |
||
137 | private function collectResponseInformations(ResponseInterface $response, StopwatchEvent $event, Stack $stack = null) |
||
147 | |||
148 | /** |
||
149 | * @param \Exception $exception |
||
150 | * @param StopwatchEvent $event |
||
151 | * @param Stack|null $stack |
||
152 | */ |
||
153 | private function collectExceptionInformations(\Exception $exception, StopwatchEvent $event, Stack $stack = null) |
||
166 | |||
167 | /** |
||
168 | * Generates the event name. |
||
169 | * |
||
170 | * @param RequestInterface $request |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | private function getStopwatchEventName(RequestInterface $request) |
||
178 | } |
||
179 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.