Code Duplication    Length = 19-24 lines in 2 locations

src/Command/InfoCommand.php 1 location

@@ 28-46 (lines=19) @@
25
    /**
26
     * @inheritDoc
27
     */
28
    protected function execute(InputInterface $input, OutputInterface $output)
29
    {
30
        $alias = $input->getArgument("alias");
31
32
        if (!$this->helper->hasAlias($alias)) {
33
            $output->writeln(sprintf(
34
                "<success>Alias `%s` does not exist.</success>",
35
                $alias
36
            ));
37
38
            return 1;
39
        }
40
41
        $package = $this->helper->getAlias($alias);
42
43
        $output->writeln(sprintf("Alias `%s` is set to: <comment>%s</comment>", $alias, $package));
44
45
        return 0;
46
    }
47
}
48

src/Command/UnaliasCommand.php 1 location

@@ 35-58 (lines=24) @@
32
    /**
33
     * @inheritDoc
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $alias = $input->getArgument("alias");
38
39
        if ($this->helper->hasAlias($alias)) {
40
            if ($input->getOption("dry-run") !== true) {
41
                $this->helper->unsetAlias($alias);
42
            }
43
44
            $output->writeln(sprintf(
45
                "<success>Alias `%s` successfully removed.</success>",
46
                $alias
47
            ));
48
49
            return 0;
50
        }
51
52
        $output->writeln(sprintf(
53
            "<comment>Alias `%s` does not exist.</comment>",
54
            $alias
55
        ));
56
57
        return 1;
58
    }
59
}
60