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

PdoConnectionCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A getChecks() 0 4 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