Code Duplication    Length = 12-14 lines in 3 locations

src/Alias/Task/Listing.php 1 location

@@ 53-66 (lines=14) @@
50
     * @param OutputInterface $output
51
     * @return int
52
     */
53
    private function listAlias($aliasName, OutputInterface $output)
54
    {
55
        if(!$this->getService('alias_manager')->has($aliasName)){
56
            $textFinder = new Finder($aliasName, array_keys($this->getService('alias_manager')->getAll()));
57
            $output->writeln(sprintf(
58
                '<error>Alias "%s" not found! Did you mean "%s"?</error>',
59
                $aliasName,
60
                $textFinder->first()
61
            ));
62
            return ITask::BLOCKING_ERROR_CODE;
63
        }
64
        $output->writeln($this->mapAlias($this->getService('alias_manager')->get($aliasName)));
65
        return ITask::NO_ERROR_CODE;
66
    }
67
68
    /**
69
     * @param Alias[] $aliases

src/Module/Task/Listing.php 1 location

@@ 37-50 (lines=14) @@
34
     * @param OutputInterface $output
35
     * @return int
36
     */
37
    private function listModule($moduleName, OutputInterface $output)
38
    {
39
        if(!$this->getService('module_manager')->has($moduleName)){
40
            $textFinder = new Finder($moduleName, array_keys($this->getService('module_manager')->getAll()->getArrayCopy()));
41
            $output->writeln(sprintf(
42
                '<error>Module "%s" not found! Did you mean "%s"?</error>',
43
                $moduleName,
44
                $textFinder->first()
45
            ));
46
            return ITask::BLOCKING_ERROR_CODE;
47
        }
48
        $output->writeln($this->mapModule($this->getService('module_manager')->get($moduleName)));
49
        return ITask::NO_ERROR_CODE;
50
    }
51
52
    /**
53
     * @param OutputInterface $output

src/Module/Task/Updating.php 1 location

@@ 35-46 (lines=12) @@
32
     * @param OutputInterface $output
33
     * @return int
34
     */
35
    private function updateModule(InputInterface $input, OutputInterface $output)
36
    {
37
        $moduleName = $input->getArgument('name');
38
        if (!$this->getService('module_manager')->has($moduleName)) {
39
            $output->writeln(sprintf('<error>Error: no module "%s" found</error>', $moduleName));
40
            return ITask::BLOCKING_ERROR_CODE;
41
        }
42
43
        $this->getService('module_procedure')->setOutput($output);
44
        $this->getService('module_procedure')->update($this->getService('module_manager')->get($moduleName));
45
        return ITask::NO_ERROR_CODE;
46
    }
47
48
    /**
49
     * @param OutputInterface $output