| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 2 | public function send(Event $event): void |
|
| 28 | { |
||
| 29 | 2 | if (!isset($this->listeners[get_class($event)])) { |
|
| 30 | 1 | throw EventBusException::report( |
|
| 31 | 1 | ExceptionType::DOMAIN(), |
|
| 32 | 1 | 'domain.eventbus.event.unkown', |
|
| 33 | 1 | sprintf('"%s" listeners.', static::class), |
|
| 34 | 1 | sprintf('You may have forgot to add the "%s" event to the "%s" eventBus.', get_class($event), static::class) |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | 1 | foreach ($this->listeners[get_class($event)] as $listener) { |
|
| 39 | 1 | $listener->listen($event); |
|
| 40 | } |
||
| 41 | 1 | } |
|
| 42 | } |
||
| 43 |