Completed
Push — master ( 88eea6...1145d2 )
by Freek
02:10
created

Elasticsearch   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 12 2
1
<?php
2
3
namespace Spatie\ServerMonitor\CheckDefinitions;
4
5
use Symfony\Component\Process\Process;
6
7
final class Elasticsearch extends CheckDefinition
8
{
9
    public $command = 'curl http://localhost:9200';
10
11
    public function resolve(Process $process)
12
    {
13
        $checkSucceeded = str_contains($process->getOutput(), 'lucene_version');
14
15
        if ($checkSucceeded) {
16
            $this->check->succeed('is running');
17
18
            return;
19
        }
20
21
        $this->check->fail('is not running');
22
    }
23
}
24