1 | <?php |
||
15 | class MaintenanceSubscriber implements EventSubscriberInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var LoggerInterface |
||
19 | */ |
||
20 | private $logger; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $maintenance; |
||
26 | |||
27 | /** |
||
28 | * MaintenanceSubscriber constructor. |
||
29 | * |
||
30 | * @param Router $router |
||
31 | * @param string $maintenance |
||
32 | */ |
||
33 | public function __construct(Router $router, $maintenance) |
||
38 | |||
39 | /** |
||
40 | * @return array |
||
41 | */ |
||
42 | public static function getSubscribedEvents() |
||
48 | |||
49 | /** |
||
50 | * @param GetResponseEvent $event |
||
51 | */ |
||
52 | public function onKernelRequest(GetResponseEvent $event) |
||
71 | |||
72 | /** |
||
73 | * @param LoggerInterface $logger |
||
74 | */ |
||
75 | public function setLogger(LoggerInterface $logger) |
||
79 | |||
80 | /** |
||
81 | * @return bool |
||
82 | */ |
||
83 | private function isInMentenance() |
||
91 | |||
92 | /** |
||
93 | * @return bool |
||
94 | */ |
||
95 | private function isDueDate() |
||
108 | } |
||
109 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: