HttpServiceCollection::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
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