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

Read   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

4 Methods

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