Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
57 | public function loadAverage(): LoadAverage |
||
58 | 3 | { |
|
59 | 3 | $now = $this->clock->now(); |
|
60 | 3 | ||
61 | if ( |
||
62 | $this->cachedAt && |
||
63 | 3 | $this->threshold->longerThan( |
|
64 | $now->elapsedSince($this->cachedAt) |
||
65 | ) |
||
66 | 3 | ) { |
|
67 | 3 | /** @psalm-suppress NullableReturnStatement */ |
|
68 | return $this->data; |
||
|
|||
69 | 3 | } |
|
70 | |||
71 | $this->data = $this->server->loadAverage(); |
||
72 | 3 | $this->cachedAt = $now; |
|
73 | |||
74 | 3 | return $this->data; |
|
75 | } |
||
87 |