Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
53 | public function loadAverage(): LoadAverage |
||
54 | 2 | { |
|
55 | $now = $this->clock->now(); |
||
56 | |||
57 | 2 | if ( |
|
58 | 2 | $this->cachedAt && |
|
59 | 2 | $this->threshold->longerThan( |
|
60 | $now->elapsedSince($this->cachedAt) |
||
61 | ) |
||
62 | 2 | ) { |
|
63 | return $this->data; |
||
64 | } |
||
65 | 2 | ||
66 | 2 | $this->data = $this->server->loadAverage(); |
|
67 | $this->cachedAt = $now; |
||
68 | 2 | ||
69 | return $this->data; |
||
70 | } |
||
82 |