Code Duplication    Length = 10-10 lines in 4 locations

src/Phinx/Db/Plan/Plan.php 4 locations

@@ 379-388 (lines=10) @@
376
            ->reject(function ($action) {
377
                return isset($this->tableCreates[$action->getTable()->getName()]);
378
            })
379
            ->each(function ($action) {
380
                $table = $action->getTable();
381
                $name = $table->getName();
382
383
                if (!isset($this->tableUpdates[$name])) {
384
                    $this->tableUpdates[$name] = new AlterTable($table);
385
                }
386
387
                $this->tableUpdates[$name]->addAction($action);
388
            });
389
    }
390
391
    /**
@@ 406-415 (lines=10) @@
403
                    || $action instanceof ChangePrimaryKey
404
                    || $action instanceof ChangeComment;
405
            })
406
            ->each(function ($action) {
407
                $table = $action->getTable();
408
                $name = $table->getName();
409
410
                if (!isset($this->tableMoves[$name])) {
411
                    $this->tableMoves[$name] = new AlterTable($table);
412
                }
413
414
                $this->tableMoves[$name]->addAction($action);
415
            });
416
    }
417
418
    /**
@@ 436-445 (lines=10) @@
433
                // so we don't wan't them here too
434
                return isset($this->tableCreates[$action->getTable()->getName()]);
435
            })
436
            ->each(function ($action) {
437
                $table = $action->getTable();
438
                $name = $table->getName();
439
440
                if (!isset($this->indexes[$name])) {
441
                    $this->indexes[$name] = new AlterTable($table);
442
                }
443
444
                $this->indexes[$name]->addAction($action);
445
            });
446
    }
447
448
    /**
@@ 461-470 (lines=10) @@
458
                return $action instanceof AddForeignKey
459
                    || $action instanceof DropForeignKey;
460
            })
461
            ->each(function ($action) {
462
                $table = $action->getTable();
463
                $name = $table->getName();
464
465
                if (!isset($this->constraints[$name])) {
466
                    $this->constraints[$name] = new AlterTable($table);
467
                }
468
469
                $this->constraints[$name]->addAction($action);
470
            });
471
    }
472
}
473