1 | <?php |
||
24 | final class RestEventSubscriber implements EventSubscriberInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var Response |
||
28 | */ |
||
29 | private $response; |
||
30 | |||
31 | /** |
||
32 | * @var RestEvent |
||
33 | */ |
||
34 | private $restEvent; |
||
35 | |||
36 | /** |
||
37 | * @var ContainerInterface |
||
38 | */ |
||
39 | private $container; |
||
40 | |||
41 | /** |
||
42 | * @param Response $response Response |
||
43 | * @param RestEvent $restEvent Rest event |
||
44 | * @param ContainerInterface $container Container |
||
45 | */ |
||
46 | public function __construct(Response $response, RestEvent $restEvent, ContainerInterface $container) |
||
52 | |||
53 | /** |
||
54 | * Returns the subscribed events |
||
55 | * |
||
56 | * @return array $ret Events to subscribe |
||
|
|||
57 | */ |
||
58 | 2 | public static function getSubscribedEvents() |
|
72 | |||
73 | /** |
||
74 | * Handler for kernel.request events |
||
75 | * |
||
76 | * @param GetResponseEvent $event Event |
||
77 | * @param string $name Event name |
||
78 | * @param EventDispatcherInterface $dispatcher Event dispatcher |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | public function onKernelRequest(GetResponseEvent $event, $name, EventDispatcherInterface $dispatcher) |
||
89 | |||
90 | /** |
||
91 | * Get a RestEvent object -> put this in a factory |
||
92 | * |
||
93 | * @param Event $event Original event (kernel.request / kernel.response) |
||
94 | * |
||
95 | * @return RestEvent $restEvent |
||
96 | */ |
||
97 | private function getEventObject(Event $event) |
||
117 | |||
118 | /** |
||
119 | * Handler for kernel.response events |
||
120 | * |
||
121 | * @param FilterResponseEvent $event Event |
||
122 | * @param string $name Event name |
||
123 | * @param EventDispatcherInterface $dispatcher Event dispatcher |
||
124 | * |
||
125 | * @return void |
||
126 | */ |
||
127 | public function onKernelResponse(FilterResponseEvent $event, $name, EventDispatcherInterface $dispatcher) |
||
131 | } |
||
132 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.