1 | <?php |
||
33 | class IvoryHttpAdapterDataCollector extends AbstractFormatterSubscriber implements DataCollectorInterface, \Countable, \Serializable |
||
34 | { |
||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $datas = [ |
||
39 | 'responses' => [], |
||
40 | 'exceptions' => [], |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function collect(Request $request, Response $response, \Exception $exception = null) |
||
50 | |||
51 | /** |
||
52 | * @return array |
||
53 | */ |
||
54 | public function getResponses() |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getExceptions() |
||
66 | |||
67 | /** |
||
68 | * @return float |
||
69 | */ |
||
70 | public function getTime() |
||
80 | |||
81 | /** |
||
82 | * @param RequestCreatedEvent $event |
||
83 | */ |
||
84 | public function onRequestCreated(RequestCreatedEvent $event) |
||
88 | |||
89 | /** |
||
90 | * @param RequestSentEvent $event |
||
91 | */ |
||
92 | public function onRequestSent(RequestSentEvent $event) |
||
100 | |||
101 | /** |
||
102 | * @param RequestErroredEvent $event |
||
103 | */ |
||
104 | public function onRequestErrored(RequestErroredEvent $event) |
||
108 | |||
109 | /** |
||
110 | * @param MultiRequestCreatedEvent $event |
||
111 | */ |
||
112 | public function onMultiRequestCreated(MultiRequestCreatedEvent $event) |
||
122 | |||
123 | /** |
||
124 | * @param MultiRequestSentEvent $event |
||
125 | */ |
||
126 | public function onMultiRequestSent(MultiRequestSentEvent $event) |
||
139 | |||
140 | /** |
||
141 | * @param MultiRequestErroredEvent $event |
||
142 | */ |
||
143 | public function onMultiRequestErrored(MultiRequestErroredEvent $event) |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | public function getName() |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function count() |
||
165 | |||
166 | /** |
||
167 | * {@inheritdoc} |
||
168 | */ |
||
169 | public function serialize() |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function unserialize($serialized) |
||
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | */ |
||
185 | public static function getSubscribedEvents() |
||
196 | |||
197 | /** |
||
198 | * @param HttpAdapterInterface $httpAdapter |
||
199 | * @param InternalRequestInterface $request |
||
200 | * @param ResponseInterface $response |
||
201 | * |
||
202 | * @return InternalRequestInterface |
||
203 | */ |
||
204 | private function collectResponse( |
||
219 | |||
220 | /** |
||
221 | * @param HttpAdapterInterface $httpAdapter |
||
222 | * @param HttpAdapterException $exception |
||
223 | * |
||
224 | * @return InternalRequestInterface |
||
225 | */ |
||
226 | private function collectException(HttpAdapterInterface $httpAdapter, HttpAdapterException $exception) |
||
241 | } |
||
242 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: