@@ 38-44 (lines=7) @@ | ||
35 | * @param string $eventName name of the event to listen to |
|
36 | * @param \PEIP\INF\Event\Connectable $connectable instance of \PEIP\INF\Event\Connectable to listen to |
|
37 | */ |
|
38 | protected function doListen($eventName, \PEIP\INF\Event\Connectable $connectable) |
|
39 | { |
|
40 | if (!$connectable->hasListener($eventName, $this)) { |
|
41 | $connectable->connect($eventName, $this); |
|
42 | $this->connections[spl_object_hash($connectable)] = $connectable; |
|
43 | } |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Disonnects the event-pipe from listening to a given event on a \PEIP\INF\Event\Connectable instance. |
|
@@ 52-58 (lines=7) @@ | ||
49 | * @param string $eventName name of the event to unlisten |
|
50 | * @param \PEIP\INF\Event\Connectable $connectable instance of \PEIP\INF\Event\Connectable to unlisten to |
|
51 | */ |
|
52 | protected function doUnlisten($eventName, \PEIP\INF\Event\Connectable $connectable) |
|
53 | { |
|
54 | if (!$connectable->hasListener($eventName, $this)) { |
|
55 | $connectable->disconnect($eventName, $this); |
|
56 | unset($this->connections[spl_object_hash($connectable)]); |
|
57 | } |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Returns the instances of \PEIP\INF\Event\Connectable the event-pipe is litening to. |