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