Code Duplication    Length = 18-18 lines in 2 locations

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

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

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

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