Completed
Push — master ( 2afe63...db6e9c )
by Christian
02:24
created

Manager   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A install() 0 8 4
A uninstall() 0 8 4
1
<?php
2
3
namespace uuf6429\ElderBrother\Vcs;
4
5
use Psr\Log\LoggerInterface;
6
7
class Manager
8
{
9
    /**
10
     * @var LoggerInterface
11
     */
12
    protected $logger;
13
14
    /**
15
     * @var Adapter\Adapter[]
16
     */
17
    protected $adapters;
18
19
    /**
20
     * @param LoggerInterface $logger
21
     */
22
    public function __construct(LoggerInterface $logger)
23
    {
24
        $this->logger = $logger;
25
        $this->adapters = [
26
            new Adapter\Git($logger),
27
        ];
28
    }
29
30
    public function install()
31
    {
32
        foreach ($this->adapters as $adapter) {
33
            if ($adapter->isAvailable() && !$adapter->isInstalled()) {
34
                $adapter->install();
35
            }
36
        }
37
    }
38
39
    public function uninstall()
40
    {
41
        foreach ($this->adapters as $adapter) {
42
            if ($adapter->isAvailable() && $adapter->isInstalled()) {
43
                $adapter->uninstall();
44
            }
45
        }
46
    }
47
}
48