Code Duplication    Length = 18-18 lines in 2 locations

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

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

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

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