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

Elasticsearch::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
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