Completed
Pull Request — master (#139)
by
unknown
04:28
created

PdoConnectionCollection::getChecks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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