Completed
Pull Request — master (#86)
by Eduardo
01:31
created

Memcached   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Spatie\ServerMonitor\CheckDefinitions;
4
5
use Symfony\Component\Process\Process;
6
7
class Memcached extends CheckDefinition
8
{
9
    public $command = 'service memcached status';
10
11
    public function resolve(Process $process)
12
    {
13
        if (str_contains($process->getOutput(), 'memcached is running')) || (str_contains($process->getOutput(), 'active (running)') ) {
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_BOOLEAN_OR
Loading history...
14
            $this->check->succeed('is running');
15
16
            return;
17
        }
18
19
        $this->check->fail('is not running');
20
    }
21
}
22