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