| Total Complexity | 4 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | final class EventHandler implements EventHandlerInterface |
||
| 10 | { |
||
| 11 | /** @var array<int, callable(ContainerInterface): void> */ |
||
| 12 | private array $events = []; |
||
| 13 | |||
| 14 | 2 | public function __construct( |
|
| 15 | private readonly ContainerInterface $dic |
||
|
|
|||
| 16 | ) { |
||
| 17 | } |
||
| 18 | |||
| 19 | 1 | public function fire( |
|
| 20 | callable $event |
||
| 21 | ): void { |
||
| 22 | 1 | $this->events[] = $event; |
|
| 23 | } |
||
| 24 | |||
| 25 | 2 | public function run(): void |
|
| 26 | { |
||
| 27 | 2 | foreach ($this->events as $event) { |
|
| 28 | 1 | $event($this->dic); |
|
| 29 | } |
||
| 32 |