Conditions | 7 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function getEventManager() |
||
32 | { |
||
33 | if (!$this->events instanceof EventManagerInterface) { |
||
34 | $identifiers = array(__CLASS__, get_called_class()); |
||
35 | if (isset($this->eventIdentifier)) { |
||
36 | if ((is_string($this->eventIdentifier)) |
||
37 | || (is_array($this->eventIdentifier)) |
||
38 | || ($this->eventIdentifier instanceof Traversable) |
||
39 | ) { |
||
40 | $identifiers = array_unique($identifiers + (array) $this->eventIdentifier); |
||
41 | } elseif (is_object($this->eventIdentifier)) { |
||
|
|||
42 | $identifiers[] = $this->eventIdentifier; |
||
43 | } |
||
44 | // silently ignore invalid eventIdentifier types |
||
45 | } |
||
46 | $this->setEventManager(new EventManager(null, $identifiers)); |
||
47 | } |
||
48 | return $this->events; |
||
49 | } |
||
50 | } |
||
51 |
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: