| Conditions | 6 |
| Paths | 24 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function handle(DummyCommand $command): void |
||
| 31 | { |
||
| 32 | try { |
||
| 33 | if ($command instanceof InitiatorCommand) { |
||
| 34 | $aggregate = DummyAggregate::create($command->aggregateRootId()); |
||
| 35 | |||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** @var DummyAggregate $aggregate */ |
||
| 40 | $aggregate = $this->repository->retrieve($command->aggregateRootId()); |
||
| 41 | |||
| 42 | if ($command instanceof PerformDummyTask) { |
||
| 43 | $aggregate->performDummyTask(); |
||
| 44 | } elseif ($command instanceof IgnoredCommand) { |
||
| 45 | $aggregate->dontDoAnything(); |
||
| 46 | } elseif ($command instanceof ExceptionInducingCommand) { |
||
| 47 | $aggregate->throwAnException(); |
||
| 48 | } elseif ($command instanceof DummyIncrementCommand) { |
||
| 49 | $aggregate->increment(); |
||
| 50 | } |
||
| 51 | } finally { |
||
| 52 | $this->repository->persist($aggregate); |
||
| 53 | } |
||
| 56 |