Passed
Push — master ( 7f2fab...c30bd6 )
by Romain
01:30 queued 11s
created

Delivery::getSequence()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class Delivery
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $watermark;
13
14
    /**
15
     * @var array
16
     */
17
    protected $messageIds;
18
19
    /**
20
     * Delivery constructor.
21
     *
22
     * @param array $messageIds
23
     * @param int   $watermark
24
     */
25 2
    public function __construct(int $watermark, array $messageIds = [])
26
    {
27 2
        $this->watermark = $watermark;
28 2
        $this->messageIds = $messageIds;
29 2
    }
30
31
    /**
32
     * @return int
33
     */
34 1
    public function getWatermark(): int
35
    {
36 1
        return $this->watermark;
37
    }
38
39
    /**
40
     * @return array
41
     */
42 1
    public function getMessageIds(): array
43
    {
44 1
        return $this->messageIds;
45
    }
46
47
    /**
48
     * @param array $callbackData
49
     *
50
     * @return \Kerox\Messenger\Model\Callback\Delivery
51
     */
52 1
    public static function create(array $callbackData): self
53
    {
54 1
        $messageIds = $callbackData['mids'] ?? [];
55
56 1
        return new self($callbackData['watermark'], $messageIds);
57
    }
58
}
59