Code Duplication    Length = 18-18 lines in 2 locations

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

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

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
    }