| 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 |
||
| 42 | public function cpu(): Cpu |
||
| 43 | 3 | { |
|
| 44 | 3 | $now = $this->clock->now(); |
|
| 45 | 3 | ||
| 46 | if ( |
||
| 47 | $this->cachedAt && |
||
| 48 | 3 | $this->threshold->longerThan( |
|
| 49 | $now->elapsedSince($this->cachedAt) |
||
| 50 | ) |
||
| 51 | 3 | ) { |
|
| 52 | 3 | /** @psalm-suppress NullableReturnStatement */ |
|
| 53 | return $this->data; |
||
|
|
|||
| 54 | 3 | } |
|
| 55 | |||
| 56 | $this->data = $this->server->cpu(); |
||
| 57 | 3 | $this->cachedAt = $now; |
|
| 58 | |||
| 59 | 3 | return $this->data; |
|
| 60 | } |
||
| 87 |