1 | <?php |
||
9 | abstract class EventProvider implements EventManagerAwareInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var EventManagerInterface |
||
13 | */ |
||
14 | protected $events; |
||
15 | /** |
||
16 | * Set the event manager instance used by this context |
||
17 | * |
||
18 | * @param EventManagerInterface $events |
||
19 | * @return mixed |
||
20 | */ |
||
21 | public function setEventManager(EventManagerInterface $events) |
||
39 | /** |
||
40 | * Retrieve the event manager |
||
41 | * |
||
42 | * Lazy-loads an EventManager instance if none registered. |
||
43 | * |
||
44 | * @return EventManagerInterface |
||
45 | */ |
||
46 | public function getEventManager() |
||
53 | } |
||
54 |
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: