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