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

Delivery   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 9
c 1
b 0
f 1
dl 0
loc 50
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getWatermark() 0 3 1
A getMessageIds() 0 3 1
A create() 0 5 1
A __construct() 0 4 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