Completed
Push — master ( b67e90...998fa4 )
by Constantin
06:57
created

CommandMetadata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 60
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommandId() 0 4 1
A withCommandId() 0 6 1
A withoutCommandId() 0 6 1
A getCorrelationId() 0 4 1
A withCorrelationId() 0 6 1
A withoutCorrelationId() 0 6 1
1
<?php
2
/**
3
 * Copyright (c) 2018 Constantin Galbenu <[email protected]>
4
 */
5
6
namespace Gica\Cqrs\Command;
7
8
9
use Gica\Types\Guid;
10
11
class CommandMetadata
12
{
13
    /** @var Guid|null */
14
    private $commandId = null;
15
16
    /** @var Guid|null */
17
    private $correlationId = null;
18
19 1
    public function getCommandId():?Guid
20
    {
21 1
        return $this->commandId;
22
    }
23
24
    /**
25
     * @param Guid $commandId
26
     * @return static
27
     */
28 2
    public function withCommandId(Guid $commandId)
29
    {
30 2
        $other = clone $this;
31 2
        $other->commandId = $commandId;
32 2
        return $other;
33
    }
34
35
    /**
36
     * @return static
37
     */
38 1
    public function withoutCommandId()
39
    {
40 1
        $other = clone $this;
41 1
        $other->commandId = null;
42 1
        return $other;
43
    }
44
45 1
    public function getCorrelationId():?Guid
46
    {
47 1
        return $this->correlationId;
48
    }
49
50
    /**
51
     * @param Guid $correlationId
52
     * @return static
53
     */
54 1
    public function withCorrelationId(Guid $correlationId)
55
    {
56 1
        $other = clone $this;
57 1
        $other->correlationId = $correlationId;
58 1
        return $other;
59
    }
60
61
    /**
62
     * @return static
63
     */
64 1
    public function withoutCorrelationId()
65
    {
66 1
        $other = clone $this;
67 1
        $other->correlationId = null;
68 1
        return $other;
69
    }
70
}