Code Duplication    Length = 49-49 lines in 2 locations

src/Cli/BuildCommand.php 1 location

@@ 12-60 (lines=49) @@
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class BuildCommand extends Command
13
{
14
    /**
15
     * @var ProjectManager
16
     */
17
    private $projectManager;
18
19
    /**
20
     * @var Project
21
     */
22
    private $project;
23
24
    /**
25
     * @param DockerComposeProjectManager $projectManager
26
     * @param Project        $project
27
     */
28
    public function __construct(DockerComposeProjectManager $projectManager, Project $project)
29
    {
30
        parent::__construct();
31
32
        $this->projectManager = $projectManager;
33
        $this->project = $project;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    protected function configure()
40
    {
41
        $this
42
            ->setName('build')
43
            ->setDescription('Build and Reset the containers of the project')
44
            ->addArgument('container', InputArgument::IS_ARRAY, 'Component names')
45
        ;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        $containers = $input->getArgument('container');
54
        $this->projectManager->build($this->project, $containers);
55
56
        $output->writeln([
57
            'Container(s) built and successfully reset.',
58
        ]);
59
    }
60
}
61

src/Cli/ResetCommand.php 1 location

@@ 12-60 (lines=49) @@
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class ResetCommand extends Command
13
{
14
    /**
15
     * @var ProjectManager
16
     */
17
    private $projectManager;
18
19
    /**
20
     * @var Project
21
     */
22
    private $project;
23
24
    /**
25
     * @param ProjectManager $projectManager
26
     * @param Project        $project
27
     */
28
    public function __construct(ProjectManager $projectManager, Project $project)
29
    {
30
        parent::__construct();
31
32
        $this->projectManager = $projectManager;
33
        $this->project = $project;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    protected function configure()
40
    {
41
        $this
42
            ->setName('reset')
43
            ->setDescription('Reset the containers of the project')
44
            ->addArgument('container', InputArgument::IS_ARRAY, 'Component names')
45
        ;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        $containers = $input->getArgument('container');
54
        $this->projectManager->reset($this->project, $containers);
55
56
        $output->writeln([
57
            'Container(s) successfully reset.',
58
        ]);
59
    }
60
}
61