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