InMemoryStoredMessage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 73
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getId() 0 4 1
A getTransportOperations() 0 4 1
A isIsDispatched() 0 4 1
A getStoredAt() 0 4 1
A markAsDispatched() 0 5 1
1
<?php
2
namespace PSB\Core\Persistence\InMemory\Outbox;
3
4
5
use PSB\Core\Outbox\OutboxTransportOperation;
6
7
class InMemoryStoredMessage
8
{
9
    /**
10
     * @var string
11
     */
12
    private $id;
13
14
    /**
15
     * @var OutboxTransportOperation[]
16
     */
17
    private $transportOperations;
18
19
    /**
20
     * @var bool
21
     */
22
    private $isDispatched = false;
23
24
    /**
25
     * @var \DateTime
26
     */
27
    private $storedAt;
28
29
    /**
30
     * InMemoryStoredMessage constructor.
31
     *
32
     * @param string                     $messageId
33
     * @param OutboxTransportOperation[] $transportOperations
34
     */
35 10
    public function __construct($messageId, array $transportOperations)
36
    {
37 10
        $this->id = $messageId;
38 10
        $this->transportOperations = $transportOperations;
39 10
        $this->storedAt = new \DateTime('now', new \DateTimeZone('UTC'));
40 10
    }
41
42
    /**
43
     * @return string
44
     */
45 1
    public function getId()
46
    {
47 1
        return $this->id;
48
    }
49
50
    /**
51
     * @return OutboxTransportOperation[]
52
     */
53 3
    public function getTransportOperations()
54
    {
55 3
        return $this->transportOperations;
56
    }
57
58
    /**
59
     * @return boolean
60
     */
61 2
    public function isIsDispatched()
62
    {
63 2
        return $this->isDispatched;
64
    }
65
66
    /**
67
     * @return \DateTime
68
     */
69 1
    public function getStoredAt()
70
    {
71 1
        return $this->storedAt;
72
    }
73
74 2
    public function markAsDispatched()
75
    {
76 2
        $this->isDispatched = true;
77 2
        $this->transportOperations = [];
78 2
    }
79
}
80