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