Completed
Push — master ( 9bb9c2...31b0e7 )
by Lukas Kahwe
11s
created

PdoConnectionCollection::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Liip\MonitorBundle\Check;
4
5
use ZendDiagnostics\Check\CheckCollectionInterface;
6
use ZendDiagnostics\Check\PDOCheck;
7
8
class PdoConnectionCollection implements CheckCollectionInterface
9
{
10
    private $checks = array();
11
12
    public function __construct(array $connections)
13
    {
14
        foreach ($connections as $name => $connection) {
15
            $check = new PDOCheck($connection['dsn'], $connection['username'], $connection['password'], $connection['timeout']);
16
            $this->checks[sprintf('pdo_%s', $name)] = $check;
17
        }
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getChecks()
24
    {
25
        return $this->checks;
26
    }
27
}
28