Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
29 | 1 | public function init() : void |
|
30 | { |
||
31 | 1 | Assert::that($this->data) |
|
32 | 1 | ->isArray()->keyExists('sendtime') |
|
33 | 1 | ->keyExists('buffered') |
|
34 | 1 | ->keyExists('received') |
|
35 | 1 | ->keyExists('rejected') |
|
36 | ; |
||
37 | |||
38 | 1 | $this->sendTime = \DateTimeImmutable::createFromFormat('d-m-Y H:i:s', $this->data['sendtime']); |
|
39 | 1 | Assert::that($this->sendTime)->isInstanceOf(\DateTimeImmutable::class, '`sendtime` does not have the correct format. Value given: '.$this->data['sendtime']); |
|
40 | |||
41 | 1 | $this->buffered = (int)$this->data['buffered']; |
|
42 | 1 | $this->received = (int)$this->data['received']; |
|
43 | 1 | $this->rejected = (int)$this->data['rejected']; |
|
44 | 1 | } |
|
45 | |||
78 |