| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5.3073 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public function handle(Command $command) |
||
| 29 | { |
||
| 30 | /** @var DummyAggregate $aggregate */ |
||
| 31 | $aggregate = $this->repository->retrieve($command->aggregateRootId()); |
||
| 32 | |||
| 33 | try { |
||
| 34 | if ($command instanceof DummyCommand) { |
||
| 35 | $aggregate->performDummyTask($this->clock); |
||
| 36 | } elseif ($command instanceof IgnoredCommand) { |
||
| 37 | $aggregate->dontDoAnything(); |
||
| 38 | } elseif ($command instanceof ExceptionInducingCommand) { |
||
| 39 | $aggregate->throwAnException(); |
||
| 40 | } elseif ($command instanceof DummyIncrementCommand) { |
||
| 41 | $aggregate->increment($this->clock); |
||
| 42 | } |
||
| 43 | } finally { |
||
| 44 | $this->repository->persist(... $aggregate->releaseEvents()); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |