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 |
||
42 | 1 | public function memory(): Memory |
|
43 | { |
||
44 | 1 | $now = $this->clock->now(); |
|
45 | |||
46 | if ( |
||
47 | 1 | $this->cachedAt && |
|
48 | 1 | $this->threshold->longerThan( |
|
49 | 1 | $now->elapsedSince($this->cachedAt) |
|
50 | ) |
||
51 | ) { |
||
52 | 1 | return $this->data; |
|
53 | } |
||
54 | |||
55 | 1 | $this->data = $this->server->memory(); |
|
56 | 1 | $this->cachedAt = $now; |
|
57 | |||
58 | 1 | return $this->data; |
|
59 | } |
||
60 | |||
76 |