PsCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 7 1
A __construct() 0 6 1
1
<?php
2
3
namespace Dock\Cli;
4
5
use Dock\Cli\Helper\ContainerList;
6
use Dock\Docker\Containers\ConfiguredContainers;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class PsCommand extends Command
12
{
13
    /**
14
     * @var ConfiguredContainers
15
     */
16
    private $configuredContainers;
17
18
    /**
19
     * @param ConfiguredContainers $configuredContainers
20
     */
21
    public function __construct(ConfiguredContainers $configuredContainers)
22
    {
23
        parent::__construct();
24
25
        $this->configuredContainers = $configuredContainers;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function configure()
32
    {
33
        $this
34
            ->setName('ps')
35
            ->setDescription('List running containers')
36
        ;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $containers = $this->configuredContainers->findAll();
45
46
        $list = new ContainerList($output);
47
        $list->render($containers);
48
    }
49
}
50