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

Manager::uninstall()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.2
cc 4
eloc 4
nc 3
nop 0
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