Total Complexity | 15 |
Total Lines | 94 |
Duplicated Lines | 0 % |
Coverage | 55.56% |
Changes | 0 |
1 | <?php |
||
9 | class EventInfo implements JsonSerializable |
||
10 | { |
||
11 | private $timestamp; |
||
12 | private $type; |
||
13 | private $id; |
||
14 | private $size; |
||
15 | private $pos; |
||
16 | private $flag; |
||
17 | private $checkSum; |
||
18 | private $sizeNoHeader; |
||
19 | private $dateTime; |
||
20 | private $binLogCurrent; |
||
21 | |||
22 | 58 | public function __construct( |
|
23 | int $timestamp, |
||
24 | int $type, |
||
25 | int $id, |
||
26 | int $size, |
||
27 | int $pos, |
||
28 | int $flag, |
||
29 | bool $checkSum, |
||
30 | BinLogCurrent $binLogCurrent |
||
31 | ) { |
||
32 | 58 | $this->timestamp = $timestamp; |
|
33 | 58 | $this->type = $type; |
|
34 | 58 | $this->id = $id; |
|
35 | 58 | $this->size = $size; |
|
36 | 58 | $this->pos = $pos; |
|
37 | 58 | $this->flag = $flag; |
|
38 | 58 | $this->checkSum = $checkSum; |
|
39 | 58 | $this->binLogCurrent = $binLogCurrent; |
|
40 | |||
41 | 58 | if ($pos > 0) { |
|
42 | 58 | $this->binLogCurrent->setBinLogPosition($pos); |
|
43 | } |
||
44 | 58 | } |
|
45 | |||
46 | 1 | public function getBinLogCurrent(): BinLogCurrent |
|
47 | { |
||
48 | 1 | return $this->binLogCurrent; |
|
49 | } |
||
50 | |||
51 | public function getDateTime(): string |
||
52 | { |
||
53 | if (empty($this->dateTime)) { |
||
54 | $this->dateTime = date('c', $this->timestamp); |
||
55 | } |
||
56 | |||
57 | return $this->dateTime; |
||
58 | } |
||
59 | |||
60 | 58 | public function getSizeNoHeader(): int |
|
67 | } |
||
68 | |||
69 | public function getTimestamp(): int |
||
70 | { |
||
71 | return $this->timestamp; |
||
72 | } |
||
73 | |||
74 | 58 | public function getType(): int |
|
75 | { |
||
76 | 58 | return $this->type; |
|
77 | } |
||
78 | |||
79 | public function getId(): int |
||
80 | { |
||
81 | return $this->id; |
||
82 | } |
||
83 | |||
84 | |||
85 | public function getSize(): int |
||
86 | { |
||
87 | return $this->size; |
||
88 | } |
||
89 | |||
90 | public function getPos(): int |
||
93 | } |
||
94 | |||
95 | public function getFlag(): int |
||
96 | { |
||
97 | return $this->flag; |
||
98 | } |
||
99 | |||
100 | public function jsonSerialize() |
||
103 | } |
||
104 | } |