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