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

TaskBasedDoctor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A examine() 0 10 2
1
<?php
2
3
namespace Dock\Doctor;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
class TaskBasedDoctor implements Doctor
8
{
9
    /**
10
     * @var Task[]
11
     */
12
    private $tasks;
13
14
    /**
15
     * @param Task[] $tasks
16
     */
17
    public function __construct(array $tasks)
18
    {
19
        $this->tasks = $tasks;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function examine(OutputInterface $output, $dryRun)
26
    {
27
        $output->writeLn('<info>Running Docker Doctor</info>');
28
29
        foreach ($this->tasks as $task) {
30
            $task->run($output, $dryRun);
31
        }
32
33
        $output->writeLn('<info>Yay! Your setup is working perfectly!</info>');
34
    }
35
}
36