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