| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function profile() : \Closure |
||
| 31 | { |
||
| 32 | $stopwatch = $this->stopwatch; |
||
| 33 | |||
| 34 | return function (callable $handler) use ($stopwatch) { |
||
| 35 | |||
| 36 | return function ($request, array $options) use ($handler, $stopwatch) { |
||
| 37 | $event = $stopwatch->start( |
||
| 38 | sprintf('%s %s', $request->getMethod(), $request->getUri()), |
||
| 39 | 'eight_points_guzzle' |
||
| 40 | ); |
||
| 41 | |||
| 42 | return $handler($request, $options)->then( |
||
| 43 | |||
| 44 | function ($response) use ($event) { |
||
| 45 | $event->stop(); |
||
| 46 | |||
| 47 | return $response; |
||
| 48 | }, |
||
| 49 | |||
| 50 | function ($reason) use ($event) { |
||
| 51 | $event->stop(); |
||
| 52 | |||
| 53 | return \GuzzleHttp\Promise\rejection_for($reason); |
||
| 54 | } |
||
| 60 |