Code Duplication    Length = 10-10 lines in 4 locations

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

@@ 424-433 (lines=10) @@
421
            ->reject(function ($action) {
422
                return isset($this->tableCreates[$action->getTable()->getName()]);
423
            })
424
            ->each(function ($action) {
425
                $table = $action->getTable();
426
                $name = $table->getName();
427
428
                if (!isset($this->tableUpdates[$name])) {
429
                    $this->tableUpdates[$name] = new AlterTable($table);
430
                }
431
432
                $this->tableUpdates[$name]->addAction($action);
433
            });
434
    }
435
436
    /**
@@ 451-460 (lines=10) @@
448
                    || $action instanceof ChangePrimaryKey
449
                    || $action instanceof ChangeComment;
450
            })
451
            ->each(function ($action) {
452
                $table = $action->getTable();
453
                $name = $table->getName();
454
455
                if (!isset($this->tableMoves[$name])) {
456
                    $this->tableMoves[$name] = new AlterTable($table);
457
                }
458
459
                $this->tableMoves[$name]->addAction($action);
460
            });
461
    }
462
463
    /**
@@ 481-490 (lines=10) @@
478
                // so we don't wan't them here too
479
                return isset($this->tableCreates[$action->getTable()->getName()]);
480
            })
481
            ->each(function ($action) {
482
                $table = $action->getTable();
483
                $name = $table->getName();
484
485
                if (!isset($this->indexes[$name])) {
486
                    $this->indexes[$name] = new AlterTable($table);
487
                }
488
489
                $this->indexes[$name]->addAction($action);
490
            });
491
    }
492
493
    /**
@@ 506-515 (lines=10) @@
503
                return $action instanceof AddForeignKey
504
                    || $action instanceof DropForeignKey;
505
            })
506
            ->each(function ($action) {
507
                $table = $action->getTable();
508
                $name = $table->getName();
509
510
                if (!isset($this->constraints[$name])) {
511
                    $this->constraints[$name] = new AlterTable($table);
512
                }
513
514
                $this->constraints[$name]->addAction($action);
515
            });
516
    }
517
}
518