| Conditions | 3 |
| Paths | 5 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function check(array $config): bool |
||
| 38 | { |
||
| 39 | try { |
||
| 40 | |||
| 41 | /** @var \Longman\LaravelLodash\ElasticSearch\ElasticSearchManagerContract $elasticsearch */ |
||
| 42 | $elasticsearch = app($config['client']); |
||
| 43 | |||
| 44 | if (! $elasticsearch->getClient()->ping()) { |
||
| 45 | $this->message = trans('lodash::checks.elasticsearch_can_be_accessed.message.not_accessible', [ |
||
| 46 | 'error' => 'Ping command was failed', |
||
| 47 | ]); |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | } catch (\Throwable $e) { |
||
| 52 | $this->message = $e->getMessage(); |
||
| 53 | |||
| 54 | return false; |
||
| 55 | } |
||
| 56 | |||
| 57 | return true; |
||
| 58 | } |
||
| 59 | |||
| 73 |