StartContainerCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
4
namespace Nexus\DockerClient\Communication\Command\Container;
5
6
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Xervice\Console\Business\Model\Command\AbstractCommand;
11
12
/**
13
 * @method \Nexus\DockerClient\Business\DockerClientFacade getFacade()
14
 */
15
class StartContainerCommand extends AbstractCommand
16
{
17
    protected function configure(): void
18
    {
19
        $this
20
            ->setName('docker:start')
21
            ->setDescription('Start a docker volume')
22
            ->addArgument('container', InputArgument::REQUIRED, 'Container name or id');
23
    }
24
25
    /**
26
     * @param \Symfony\Component\Console\Input\InputInterface $input
27
     * @param \Symfony\Component\Console\Output\OutputInterface $output
28
     *
29
     * @return int|null|void
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        $command = sprintf(
34
            'start %s',
35
            $input->getArgument('container')
36
        );
37
38
        $response = $this->getFacade()->runDocker($command);
39
40
        if ($output->isVerbose()) {
41
            $output->writeln($response);
42
        }
43
    }
44
45
46
}