Configurator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 10 3
1
<?php
2
/*
3
 * This file is part of the PommProject/PommBundle package.
4
 *
5
 * (c) 2014 - 2016 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\PommBundle\Model;
11
12
use PommProject\Foundation\Pomm;
13
use PommProject\Foundation\Session\Session;
14
15
/**
16
 * Configurator
17
 *
18
 * Pooler configurator.
19
 *
20
 * @package   PommBundle
21
 * @copyright 2014 - 2016 Grégoire HUBERT
22
 * @author    Miha Vrhovnik
23
 * @license   X11 {@link http://opensource.org/licenses/mit-license.php}
24
 */
25
class Configurator
26
{
27
    private $poolers;
28
29
    public function __construct(array $poolers)
30
    {
31
        $this->poolers = $poolers;
32
    }
33
34
    /**
35
     * @param Pomm $pomm
36
     *
37
     * @return null
38
     */
39
    public function configure(Pomm $pomm)
40
    {
41
        foreach ($pomm->getSessionBuilders() as $name => $builder) {
42
            $pomm->addPostConfiguration($name, function (Session $session) {
43
                foreach ($this->poolers as $pooler) {
44
                    $session->registerClientPooler($pooler);
45
                }
46
            });
47
        }
48
    }
49
}
50