Conditions | 5 |
Paths | 12 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function invokeTest() |
||
38 | { |
||
39 | $testResult = new TestResult('Memcache Server Group Health', 'Group ' . $this->group); |
||
40 | |||
41 | $states = array(); |
||
42 | foreach ($this->results as $result) { |
||
43 | $states[] = $result->getState(); |
||
44 | } |
||
45 | $state = min($states); |
||
46 | if ($state !== max($states)) { |
||
47 | $state = State::WARNING; |
||
48 | } |
||
49 | $testResult->setState($state); |
||
50 | |||
51 | if ($state === State::OK) { |
||
52 | $testResult->setMessage('Group is healthy'); |
||
53 | } elseif ($state === State::WARNING) { |
||
54 | $testResult->setMessage('Group is crippled'); |
||
55 | } else { |
||
56 | $testResult->setMessage('Group is down'); |
||
57 | } |
||
58 | |||
59 | $this->setTestResult($testResult); |
||
60 | } |
||
62 |