Completed
Pull Request — master (#111)
by Pete
03:07
created

DownloadDnsDock::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Dock\Installer\DNS\Mac;
4
5
use Dock\Installer\InstallerTask;
6
use Dock\IO\ProcessRunner;
7
use Dock\IO\UserInteraction;
8
use SRIO\ChainOfResponsibility\DependentChainProcessInterface;
9
10
class DownloadDnsDock extends InstallerTask implements DependentChainProcessInterface
11
{
12
    /**
13
     * @var UserInteraction
14
     */
15
    private $userInteraction;
16
17
    /**
18
     * @var ProcessRunner
19
     */
20
    private $processRunner;
21
22
    /**
23
     * @param UserInteraction $userInteraction
24
     * @param ProcessRunner $processRunner
25
     */
26
    public function __construct(UserInteraction $userInteraction, ProcessRunner $processRunner)
27
    {
28
        $this->userInteraction = $userInteraction;
29
        $this->processRunner = $processRunner;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function run()
36
    {
37
        $this->userInteraction->writeTitle("Pulling image tonistiigi/dnsdock");
38
        $this->userInteraction->write("This could take a while when run for the first time");
39
        $this->processRunner->run('docker pull tonistiigi/dnsdock');
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function dependsOn()
46
    {
47
        return ['machine'];
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getName()
54
    {
55
        return 'dnsdock';
56
    }
57
}