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