| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 24 | protected function invokeEventHandler(DomainEventInterface $event): self |
||
| 25 | { |
||
| 26 | $handlerName = (new ReflectionClass($event))->getShortName(); |
||
| 27 | $handlerMethod = 'when'.ucfirst($handlerName); |
||
| 28 | $handler = [$this, $handlerMethod]; |
||
| 29 | if (!is_callable($handler)) { |
||
| 30 | throw new RuntimeException( |
||
| 31 | sprintf("Handler '%s' is not callable on '%s'.", $handlerMethod, static::class) |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | return $handler($event); |
||
| 35 | } |
||
| 37 |