1 | <?php |
||
19 | class StopwatchPlugin implements Plugin |
||
20 | { |
||
21 | const CATEGORY = 'php_http.request'; |
||
22 | |||
23 | /** |
||
24 | * @var Stopwatch |
||
25 | */ |
||
26 | private $stopwatch; |
||
27 | |||
28 | /** |
||
29 | * @param Stopwatch $stopwatch |
||
30 | */ |
||
31 | 4 | public function __construct(Stopwatch $stopwatch) |
|
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 2 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
|
54 | |||
55 | /** |
||
56 | * Generates the event name. |
||
57 | * |
||
58 | * @param RequestInterface $request |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 2 | private function getStopwatchEventName(RequestInterface $request) |
|
66 | } |
||
67 |
If you suppress an error, we recommend checking for the error condition explicitly: