1 | <?php |
||
15 | class ApiVersionListener |
||
16 | { |
||
17 | use ControllerAnnotationExtractorTrait; |
||
18 | |||
19 | const ATTRIBUTE_API_VERSION = 'spiechu_symfony_commons.event_listener.api_version'; |
||
20 | |||
21 | /** @var Reader */ |
||
22 | protected $annotationReader; |
||
23 | |||
24 | /** @var EventDispatcherInterface */ |
||
25 | protected $eventDispatcher; |
||
26 | |||
27 | /** |
||
28 | * @param Reader $annotationReader |
||
29 | * @param EventDispatcherInterface $eventDispatcher |
||
30 | */ |
||
31 | public function __construct(Reader $annotationReader, EventDispatcherInterface $eventDispatcher) |
||
36 | |||
37 | /** |
||
38 | * @param FilterControllerEvent $event |
||
39 | * |
||
40 | * @throws \InvalidArgumentException |
||
41 | */ |
||
42 | public function onKernelController(FilterControllerEvent $event): void |
||
54 | |||
55 | /** |
||
56 | * @param null|callable $controller |
||
57 | * |
||
58 | * @return null|ApiVersion |
||
59 | */ |
||
60 | protected function getApiVersionFromController(?callable $controller): ?ApiVersion |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | protected function getAnnotationReader(): Reader |
||
72 | } |
||
73 |