Completed
Push — master ( ec3cb6...40821e )
by Lukas Kahwe
9s
created

MemcachedCollection::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Liip\MonitorBundle\Check;
4
5
use ZendDiagnostics\Check\CheckCollectionInterface;
6
use ZendDiagnostics\Check\Memcached;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
class MemcachedCollection implements CheckCollectionInterface
12
{
13
    private $checks = array();
14
15
    public function __construct(array $configs)
16
    {
17
        foreach ($configs as $name => $config) {
18
            $check = new Memcached($config['host'], $config['port']);
19
            $check->setLabel(sprintf('Memcached "%s"', $name));
20
21
            $this->checks[sprintf('memcached_%s', $name)] = $check;
22
        }
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getChecks()
29
    {
30
        return $this->checks;
31
    }
32
}
33