Passed
Push — master ( 1207ab...d0f572 )
by Frank
45s
created

DummyAggregate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 8
c 3
b 0
f 0
dl 0
loc 36
ccs 16
cts 16
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A increment() 0 4 1
A applyDummyIncrementingHappened() 0 3 1
A performDummyTask() 0 3 1
A dontDoAnything() 0 2 1
A throwAnException() 0 3 1
A applyDummyTaskWasExecuted() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing\Integration\TestingAggregates;
6
7
use EventSauce\EventSourcing\AggregateRoot;
8
use EventSauce\EventSourcing\AggregateRootBehaviour;
9
10
class DummyAggregate implements AggregateRoot
11
{
12
    use AggregateRootBehaviour;
13
14
    private $incrementedNumber = 0;
15
16 1
    public function performDummyTask()
17
    {
18 1
        $this->recordThat(new DummyTaskWasExecuted());
19 1
    }
20
21 3
    public function increment()
22
    {
23 3
        $this->recordThat(new DummyIncrementingHappened(
24 3
            $this->incrementedNumber + 1
25
        ));
26 3
    }
27
28 3
    protected function applyDummyIncrementingHappened(DummyIncrementingHappened $event)
29
    {
30 3
        $this->incrementedNumber = $event->number();
31 3
    }
32
33 1
    protected function applyDummyTaskWasExecuted(/** @scrutinizer ignore-unused */ DummyTaskWasExecuted $event)
34
    {
35
36 1
    }
37
38 1
    public function dontDoAnything()
39
    {
40
        // not doing anything.
41 1
    }
42
43 3
    public function throwAnException()
44
    {
45 3
        throw new DummyException();
46
    }
47
}
48