| Conditions | 3 |
| Paths | 7 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 3 | public function execute($command, callable $next) |
|
| 29 | { |
||
| 30 | try { |
||
| 31 | 3 | $this->getEmitter()->emit(new Event\CommandReceived($command)); |
|
| 32 | |||
| 33 | 1 | $returnValue = $next($command); |
|
| 34 | |||
| 35 | 1 | $this->getEmitter()->emit(new Event\CommandHandled($command)); |
|
| 36 | |||
| 37 | 1 | return $returnValue; |
|
| 38 | 2 | } catch (\Exception $e) { |
|
| 39 | 2 | $this->getEmitter()->emit($event = new Event\CommandFailed($command, $e)); |
|
| 40 | |||
| 41 | 2 | if (!$event->isExceptionCaught()) { |
|
| 42 | 1 | throw $e; |
|
| 43 | } |
||
| 44 | } |
||
| 45 | 1 | } |
|
| 46 | } |
||
| 47 |