| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function cpu(): Cpu |
||
| 39 | 2 | { |
|
| 40 | $now = $this->clock->now(); |
||
| 41 | |||
| 42 | 2 | if ( |
|
| 43 | 2 | $this->cachedAt && |
|
| 44 | 2 | $this->threshold->longerThan( |
|
| 45 | $now->elapsedSince($this->cachedAt) |
||
| 46 | ) |
||
| 47 | 2 | ) { |
|
| 48 | return $this->data; |
||
| 49 | } |
||
| 50 | 2 | ||
| 51 | 2 | $this->data = $this->server->cpu(); |
|
| 52 | $this->cachedAt = $now; |
||
| 53 | 2 | ||
| 54 | return $this->data; |
||
| 55 | } |
||
| 82 |