Completed
Push — master ( 95a54c...7178fa )
by Samuel
10:58
created

DoctorCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
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 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A __construct() 0 6 1
A configure() 0 13 1
1
<?php
2
3
namespace Dock\Cli\Docker;
4
5
use Dock\Doctor\Doctor;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class DoctorCommand extends Command
12
{
13
    /**
14
     * @var Doctor
15
     */
16
    private $doctor;
17
18
    /**
19
     * @param Doctor $doctor
20
     */
21
    public function __construct(Doctor $doctor)
22
    {
23
        parent::__construct();
24
25
        $this->doctor = $doctor;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function configure()
32
    {
33
        $this
34
            ->setName('docker:doctor')
35
            ->setDescription('Diagnose problems with Docker setup and attempt to fix them')
36
            ->addOption(
37
                'dry-run',
38
                null,
39
                InputOption::VALUE_NONE,
40
                "Diagnose problems, don't attempt to fix them"
41
            )
42
        ;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    protected function execute(InputInterface $input, OutputInterface $output)
49
    {
50
        $this->doctor->examine($output, $input->getOption('dry-run'));
51
    }
52
}
53