Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
47 | public function memory(): Memory |
||
48 | 3 | { |
|
49 | 3 | $now = $this->clock->now(); |
|
50 | 3 | ||
51 | if ( |
||
52 | $this->cachedAt && |
||
53 | 3 | $this->threshold->longerThan( |
|
54 | $now->elapsedSince($this->cachedAt) |
||
55 | ) |
||
56 | 3 | ) { |
|
57 | 3 | /** @psalm-suppress NullableReturnStatement */ |
|
58 | return $this->data; |
||
|
|||
59 | 3 | } |
|
60 | |||
61 | $this->data = $this->server->memory(); |
||
62 | 3 | $this->cachedAt = $now; |
|
63 | |||
64 | 3 | return $this->data; |
|
65 | } |
||
87 |