1 | <?php |
||
14 | class StopwatchListener implements EventSubscriberInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var Stopwatch |
||
18 | */ |
||
19 | private $stopwatch; |
||
20 | |||
21 | /** |
||
22 | * @var bool |
||
23 | */ |
||
24 | private $enabled; |
||
25 | |||
26 | /** |
||
27 | * @param Stopwatch $stopwatch |
||
28 | * @param bool $enabled (if false, this listener will be effectively bypassed) |
||
29 | */ |
||
30 | 4 | public function __construct(Stopwatch $stopwatch, $enabled) |
|
35 | |||
36 | /** |
||
37 | * @param FilterResponseEvent $event |
||
38 | */ |
||
39 | 4 | public function onKernelResponse(FilterResponseEvent $event) |
|
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | */ |
||
59 | public static function getSubscribedEvents() |
||
65 | |||
66 | /** |
||
67 | * Sets the header for the specified stage (eg X-API-RESPONSE-GET-VIDEOS). |
||
68 | * |
||
69 | * @param Response $response |
||
70 | * @param string $stage |
||
71 | * @param int $duration |
||
72 | */ |
||
73 | 2 | private function setHeader(Response $response, $stage, $duration) |
|
78 | } |
||
79 |