Test Failed
Push — master ( 7ebbda...77d842 )
by Mike
02:15
created

DockerRestartCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 11
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 2
A configure() 0 6 1
1
<?php
2
3
4
namespace Nexus\DockerClient\Communication\Command\Restart;
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\Command\AbstractCommand;
11
12
/**
13
 * @method \Nexus\DockerClient\DockerClientFacade getFacade()
14
 */
15
class DockerRestartCommand extends AbstractCommand
16
{
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('docker:restart')
21
            ->setDescription('Create 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
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $command = sprintf(
35
            'restart %s',
36
            $input->getArgument('container')
37
        );
38
39
        $response = $this->getFacade()->runDocker($command);
40
41
        if ($output->isVerbose()) {
42
            $output->writeln($response);
43
        }
44
    }
45
46
47
}