Total Complexity | 5 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class EventIndicator |
||
10 | { |
||
11 | public const THRESHOLD = SECONDS_IN_01MIN; |
||
12 | |||
13 | /** @var int */ |
||
14 | private $lastEventTimestamp; |
||
15 | /** @var int */ |
||
16 | private $threshold; |
||
17 | |||
18 | /** |
||
19 | * EventIndicator constructor. |
||
20 | * @param int|null $threshold |
||
21 | */ |
||
22 | 9 | public function __construct(? int $threshold = null) |
|
23 | { |
||
24 | 9 | $this->countEvent(); |
|
25 | 9 | $this->threshold = $threshold ?? static::THRESHOLD; |
|
26 | 9 | } |
|
27 | |||
28 | 9 | public function countEvent($event = null) |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return int |
||
36 | */ |
||
37 | 9 | private function current(): int |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return bool |
||
44 | */ |
||
45 | 2 | public function isNotOk(): bool |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return bool |
||
53 | */ |
||
54 | 2 | public function isOk(): bool |
|
60 |