Total Complexity | 9 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class ObserversSet implements Countable, Iterator |
||
16 | { |
||
17 | /** @var SplObjectStorage<SplObserver, null> */ |
||
18 | private $observers; |
||
19 | |||
20 | 28 | public function __construct() |
|
23 | } |
||
24 | |||
25 | 6 | public function attach(SplObserver $observer): void |
|
26 | { |
||
27 | 6 | $this->observers->attach($observer); |
|
28 | } |
||
29 | |||
30 | 2 | public function detach(SplObserver $observer): void |
|
31 | { |
||
32 | 2 | $this->observers->detach($observer); |
|
33 | } |
||
34 | |||
35 | 3 | public function count(): int |
|
38 | } |
||
39 | |||
40 | 5 | public function current(): SplObserver |
|
41 | { |
||
42 | 5 | return $this->observers->current(); |
|
43 | } |
||
44 | |||
45 | 5 | public function next(): void |
|
46 | { |
||
47 | /** @infection-ignore-all if omitted create an infinite loop */ |
||
48 | 5 | $this->observers->next(); |
|
49 | } |
||
50 | |||
51 | 2 | public function key(): int |
|
52 | { |
||
53 | 2 | return $this->observers->key(); |
|
54 | } |
||
55 | |||
56 | 25 | public function valid(): bool |
|
57 | { |
||
58 | 25 | return $this->observers->valid(); |
|
59 | } |
||
60 | |||
61 | 25 | public function rewind(): void |
|
64 | } |
||
65 | } |
||
66 |