Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | public function invokeTest(): void |
||
41 | { |
||
42 | $testResult = new TestResult('Memcache Server Health', $this->host); |
||
43 | |||
44 | if ($this->serverStats === false) { |
||
45 | $testResult->setState(State::ERROR); |
||
46 | $testResult->setMessage('Host is down'); |
||
47 | } else { |
||
48 | $bytesUsed = $this->serverStats['bytes']; |
||
49 | $bytesLimit = $this->serverStats['limit_maxbytes']; |
||
50 | $free = round(100.0 - (($bytesUsed / $bytesLimit) * 100)); |
||
51 | $testResult->addOutput($free, 'freePercentage'); |
||
52 | |||
53 | $testResult->setState(State::OK); |
||
54 | $testResult->setMessage($free . '% free space'); |
||
55 | } |
||
56 | |||
57 | $this->setTestResult($testResult); |
||
58 | } |
||
60 |