1 | <?php |
||
16 | class StopwatchListener implements EventSubscriberInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var Stopwatch |
||
20 | */ |
||
21 | private $stopwatch; |
||
22 | |||
23 | /** |
||
24 | * @var bool |
||
25 | */ |
||
26 | private $enabled; |
||
27 | |||
28 | /** |
||
29 | * @param bool $enabled (if false, this listener will be effectively bypassed) |
||
30 | 4 | */ |
|
31 | public function __construct(Stopwatch $stopwatch, bool $enabled) |
||
36 | |||
37 | public function onKernelResponse(FilterResponseEvent $event): void |
||
53 | 2 | ||
54 | 2 | public static function getSubscribedEvents(): array |
|
60 | |||
61 | /** |
||
62 | * Sets the header for the specified stage (eg X-API-RESPONSE-GET-VIDEOS). |
||
63 | */ |
||
64 | private function setHeader(Response $response, string $stage, int $duration): void |
||
71 | } |
||
72 |