Code Duplication    Length = 8-9 lines in 2 locations

Command/GenerateRestControllerCommand.php 2 locations

@@ 94-102 (lines=9) @@
91
92
        list($bundle, $controller) = $this->parseShortcutNotation($input->getOption('controller'));
93
        /** @var Bundle $bundle */
94
        if (is_string($bundle)) {
95
            $bundle = Validators::validateBundleName($bundle);
96
97
            try {
98
                $bundle = $this->getContainer()->get('kernel')->getBundle($bundle);
99
            } catch (\Exception $e) {
100
                $output->writeln(sprintf('<bg=red>Bundle "%s" does not exists.</>', $bundle));
101
            }
102
        }
103
104
        $dialog->writeSection($output, 'Controller generation: ' . $controller . 'Controller (' . $bundle->getName() . ')');
105
@@ 137-144 (lines=8) @@
134
        $generator = new RestControllerGenerator($this->getContainer()->get('filesystem'));
135
        list($bundle, $entity) = $this->parseShortcutNotation($this->input->getOption('entity'));
136
        $generator->setEntityName($entity);
137
        if (is_string($bundle)) {
138
            $bundle = Validators::validateBundleName($bundle);
139
            try {
140
                $bundle = $this->getContainer()->get('kernel')->getBundle($bundle);
141
            } catch (\Exception $e) {
142
                $this->output->writeln(sprintf('<bg=red>Bundle "%s" does not exists.</>', $bundle));
143
            }
144
        }
145
        /** @todo Check entity is a valid entity */
146
        if ($this->input->getOption("mongo")) {
147
            $generator->setMongo(true);