HttpServiceCollection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 47.37 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 9
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 2
A getChecks() 0 4 1

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 Liip\MonitorBundle\Check;
4
5
use Laminas\Diagnostics\Check\CheckCollectionInterface;
6
use Laminas\Diagnostics\Check\HttpService;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
class HttpServiceCollection implements CheckCollectionInterface
12
{
13
    private $checks = [];
14
15 1 View Code Duplication
    public function __construct(array $configs)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17 1
        foreach ($configs as $name => $config) {
18 1
            $check = new HttpService($config['host'], $config['port'], $config['path'], $config['status_code'], $config['content']);
19 1
            $check->setLabel(sprintf('Http Service "%s"', $name));
20
21 1
            $this->checks[sprintf('http_service_%s', $name)] = $check;
22
        }
23 1
    }
24
25 1
    public function getChecks()
26
    {
27 1
        return $this->checks;
28
    }
29
}
30