| @@ 56-67 (lines=12) @@ | ||
| 53 | * |
|
| 54 | * @return $this |
|
| 55 | */ |
|
| 56 | public function removeListener(string $eventName, callable $listener) : self |
|
| 57 | { |
|
| 58 | if (array_key_exists($eventName, $this->listeners)) { |
|
| 59 | $index = array_search($listener, $this->listeners[$eventName], true); |
|
| 60 | ||
| 61 | if (false !== $index) { |
|
| 62 | unset($this->listeners[$eventName][$index]); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | return $this; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * @param string $eventName |
|
| @@ 56-67 (lines=12) @@ | ||
| 53 | * |
|
| 54 | * @return $this |
|
| 55 | */ |
|
| 56 | public function removeListener(string $event, callable $listener) : self |
|
| 57 | { |
|
| 58 | if (array_key_exists($event, $this->listeners)) { |
|
| 59 | $index = array_search($listener, $this->listeners[$event], true); |
|
| 60 | ||
| 61 | if (false !== $index) { |
|
| 62 | unset($this->listeners[$event][$index]); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | return $this; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * @param string $event |
|