Code Duplication    Length = 10-11 lines in 2 locations

Command/GenerateCommand.php 1 location

@@ 259-268 (lines=10) @@
256
                    $warning = 'Note: the generated migration is empty';
257
                }
258
259
                switch ($fileType) {
260
                    case 'yml':
261
                        $code = Yaml::dump($data, 5);
262
                        break;
263
                    case 'json':
264
                        $code = json_encode($data, JSON_PRETTY_PRINT);
265
                        break;
266
                    default:
267
                        throw new \Exception("The combination of migration type '$migrationType' is not supported with format '$fileType'");
268
                }
269
        }
270
271
        file_put_contents($path, $code);

Core/Executor/ReferenceExecutor.php 1 location

@@ 143-153 (lines=11) @@
140
        $data = $this->referenceResolver->listReferences();
141
142
        $ext = pathinfo($fileName, PATHINFO_EXTENSION);
143
        switch ($ext) {
144
            case 'json':
145
                $data = json_encode($data, JSON_PRETTY_PRINT);
146
                break;
147
            case 'yml':
148
            case 'yaml':
149
                $data = Yaml::dump($data);
150
                break;
151
            default:
152
                throw new \Exception("Invalid step definition: unsupported file extension for saving references to");
153
        }
154
155
        file_put_contents($fileName, $data);
156