Code Duplication    Length = 10-10 lines in 4 locations

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

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