Code Duplication    Length = 18-18 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Tools/Console/Command/Schema/DropCommand.php 1 location

@@ 39-56 (lines=18) @@
36
        $sm = $this->getSchemaManager();
37
        $isErrored = false;
38
39
        foreach ($drop as $option) {
40
            try {
41
                if (isset($class)) {
42
                    $this->{'processDocument' . ucfirst($option)}($sm, $class);
43
                } else {
44
                    $this->{'process' . ucfirst($option)}($sm);
45
                }
46
                $output->writeln(sprintf(
47
                    'Dropped <comment>%s%s</comment> for <info>%s</info>',
48
                    $option,
49
                    (isset($class) ? (self::INDEX === $option ? '(es)' : '') : (self::INDEX === $option ? 'es' : 's')),
50
                    ($class ?? 'all classes')
51
                ));
52
            } catch (\Exception $e) {
53
                $output->writeln('<error>' . $e->getMessage() . '</error>');
54
                $isErrored = true;
55
            }
56
        }
57
58
        return $isErrored ? 255 : 0;
59
    }

lib/Doctrine/ODM/MongoDB/Tools/Console/Command/Schema/CreateCommand.php 1 location

@@ 46-63 (lines=18) @@
43
        $sm = $this->getSchemaManager();
44
        $isErrored = false;
45
46
        foreach ($create as $option) {
47
            try {
48
                if (isset($class)) {
49
                    $this->{'processDocument' . ucfirst($option)}($sm, $class);
50
                } else {
51
                    $this->{'process' . ucfirst($option)}($sm);
52
                }
53
                $output->writeln(sprintf(
54
                    'Created <comment>%s%s</comment> for <info>%s</info>',
55
                    $option,
56
                    (isset($class) ? (self::INDEX === $option ? '(es)' : '') : (self::INDEX === $option ? 'es' : 's')),
57
                    ($class ?? 'all classes')
58
                ));
59
            } catch (\Exception $e) {
60
                $output->writeln('<error>' . $e->getMessage() . '</error>');
61
                $isErrored = true;
62
            }
63
        }
64
65
        return $isErrored ? 255 : 0;
66
    }