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) ? ($option === self::INDEX ? '(es)' : '') : ($option === self::INDEX ? 'es' : 's')),
64
                    $class ?? 'all classes'
65
                ));
66
            } catch (\Throwable $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

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