Command::setupPayload()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace C4tech\RayEmitter\Domain;
2
3
use stdClass;
4
use C4tech\RayEmitter\Contracts\Domain\Command as CommandInterface;
5
6
abstract class Command implements CommandInterface
7
{
8
    /**
9
     * Target aggregate root entity identifier.
10
     * @var string
11
     */
12
    protected $target_id;
13
14
    /**
15
     * Expected sequence version of the target aggregate
16
     * @var int
17
     */
18
    protected $expected_sequence = -1;
19
20
    /**
21
     * Command data payload.
22
     * @var stdClass
23
     */
24
    protected $payload;
25
26
    /**
27
     * @inheritDoc
28
     */
29 1
    public function getAggregateId()
30
    {
31 1
        return $this->target_id;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 1
    public function getExpectedSequence()
38
    {
39 1
        return $this->expected_sequence;
40
    }
41
42
    /**
43
     * @inheritDoc
44
     * @return stdClass
45
     */
46 1
    public function getPayload()
47
    {
48 1
        return $this->payload;
49
    }
50
51
    /**
52
     * Setup Payload
53
     *
54
     * Initializes the payload as an empty object.
55
     * @return void
56
     */
57 3
    protected function setupPayload()
58
    {
59 3
        $this->payload = new stdClass;
60 3
    }
61
}
62