PsCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
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