| 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 |
||
| 37 | 1 | public function cpu(): Cpu |
|
| 38 | { |
||
| 39 | 1 | $now = $this->clock->now(); |
|
| 40 | |||
| 41 | if ( |
||
| 42 | 1 | $this->cachedAt && |
|
| 43 | 1 | $this->threshold->longerThan( |
|
| 44 | 1 | $now->elapsedSince($this->cachedAt) |
|
| 45 | ) |
||
| 46 | ) { |
||
| 47 | 1 | return $this->data; |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | $this->data = $this->server->cpu(); |
|
| 51 | 1 | $this->cachedAt = $now; |
|
| 52 | |||
| 53 | 1 | return $this->data; |
|
| 54 | } |
||
| 55 | |||
| 76 |