Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 68-85 (lines=18) @@
65
        $sm = $this->getSchemaManager();
66
        $isErrored = false;
67
68
        foreach ($create as $option) {
69
            try {
70
                if (isset($class)) {
71
                    $this->{'processDocument' . ucfirst($option)}($sm, $class);
72
                } else {
73
                    $this->{'process' . ucfirst($option)}($sm);
74
                }
75
                $output->writeln(sprintf(
76
                    'Created <comment>%s%s</comment> for <info>%s</info>',
77
                    $option,
78
                    (isset($class) ? (self::INDEX === $option ? '(es)' : '') : (self::INDEX === $option ? 'es' : 's')),
79
                    (isset($class) ? $class : 'all classes')
80
                ));
81
            } catch (\Exception $e) {
82
                $output->writeln('<error>' . $e->getMessage() . '</error>');
83
                $isErrored = true;
84
            }
85
        }
86
87
        return ($isErrored) ? 255 : 0;
88
    }

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

@@ 61-78 (lines=18) @@
58
        $sm = $this->getSchemaManager();
59
        $isErrored = false;
60
61
        foreach ($drop as $option) {
62
            try {
63
                if (isset($class)) {
64
                    $this->{'processDocument' . ucfirst($option)}($sm, $class);
65
                } else {
66
                    $this->{'process' . ucfirst($option)}($sm);
67
                }
68
                $output->writeln(sprintf(
69
                    'Dropped <comment>%s%s</comment> for <info>%s</info>',
70
                    $option,
71
                    (isset($class) ? (self::INDEX === $option ? '(es)' : '') : (self::INDEX === $option ? 'es' : 's')),
72
                    (isset($class) ? $class : 'all classes')
73
                ));
74
            } catch (\Exception $e) {
75
                $output->writeln('<error>' . $e->getMessage() . '</error>');
76
                $isErrored = true;
77
            }
78
        }
79
80
        return ($isErrored) ? 255 : 0;
81
    }