Total Complexity | 7 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 64.29% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class ObserverStore |
||
6 | { |
||
7 | |||
8 | private $observers = []; |
||
9 | |||
10 | 599 | public function attach($notifier, $observer): void |
|
16 | 599 | } |
|
17 | |||
18 | public function detach($notifier, $observer): void |
||
19 | { |
||
20 | if (array_key_exists($notifier, $this->observers)) { |
||
21 | if (array_key_exists($observer, $this->observers[$notifier])) { |
||
22 | unset($this->observers[$notifier][$observer]); |
||
23 | } |
||
24 | } |
||
25 | } |
||
26 | |||
27 | 151 | public function forNotifier($notifier): array |
|
33 | } |
||
34 | } |