ConfigExpertManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A manageConfig() 0 8 2
1
<?php
2
namespace Metfan\RabbitSetup\Manager\Command;
3
4
use Metfan\RabbitSetup\Http\ClientPool;
5
use Metfan\RabbitSetup\Manager\RabbitMq\VhostManager;
6
7
/**
8
 * Manager of rsetup:config:expert Command
9
 *
10
 * @author Ulrich
11
 * @package Metfan\RabbitSetup\Manager\Command
12
 */
13
class ConfigExpertManager
14
{
15
    /**
16
     * @var ClientPool
17
     */
18
    private $clientPool;
19
20
    /**
21
     * @var VhostManager
22
     */
23
    private $vhostManager;
24
25
    public function __construct(ClientPool $clientPool, VhostManager $vhostManager)
26
    {
27
        $this->clientPool = $clientPool;
28
        $this->vhostManager = $vhostManager;
29
    }
30
31
    /**
32
     * Check config with option resolver.
33
     * Apply each vhost config with VhostManager
34
     *
35
     * @param array $config
36
     */
37
    public function manageConfig(array $config)
38
    {
39
        $this->clientPool->setConnections($config['connections']);
40
41
        foreach ($config['vhosts'] as $name => $vhostConfig) {
42
            $this->vhostManager->processVhost($name, $vhostConfig);
43
        }
44
    }
45
}
46