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