PdoConnectionCollection::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
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\PDOCheck;
7
8
class PdoConnectionCollection implements CheckCollectionInterface
9
{
10
    private $checks = [];
11
12 1
    public function __construct(array $connections)
13
    {
14 1
        foreach ($connections as $name => $connection) {
15 1
            $check = new PDOCheck($connection['dsn'], $connection['username'], $connection['password'], $connection['timeout']);
16 1
            $this->checks[sprintf('pdo_%s', $name)] = $check;
17
        }
18 1
    }
19
20 1
    public function getChecks()
21
    {
22 1
        return $this->checks;
23
    }
24
}
25