Completed
Pull Request — master (#3)
by Romain
01:47
created

Read::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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