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