| Conditions | 5 |
| Paths | 11 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function checkStatus(): Result |
||
| 41 | { |
||
| 42 | $result = new Result($this->label); |
||
| 43 | try { |
||
| 44 | if ($this->client->ping() !== true) { |
||
| 45 | $result->setSuccess(false); |
||
| 46 | return $result; |
||
| 47 | } |
||
| 48 | foreach ($this->indices as $index) { |
||
| 49 | if (!$this->client->indices()->exists(['index' => $index])) { |
||
| 50 | $result->setSuccess(false); |
||
| 51 | $result->setError("Index '$index' does not exist"); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } catch (Exception $e) { |
||
| 55 | $result->setSuccess(false); |
||
| 56 | $result->setError($e->getMessage()); |
||
| 57 | } |
||
| 58 | return $result; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |