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