Code Duplication    Length = 10-10 lines in 4 locations

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

@@ 362-371 (lines=10) @@
359
            ->reject(function ($action) {
360
                return isset($this->tableCreates[$action->getTable()->getName()]);
361
            })
362
            ->each(function ($action) {
363
                $table = $action->getTable();
364
                $name = $table->getName();
365
366
                if (!isset($this->tableUpdates[$name])) {
367
                    $this->tableUpdates[$name] = new AlterTable($table);
368
                }
369
370
                $this->tableUpdates[$name]->addAction($action);
371
            });
372
    }
373
374
    /**
@@ 389-398 (lines=10) @@
386
                    || $action instanceof ChangePrimaryKey
387
                    || $action instanceof ChangeComment;
388
            })
389
            ->each(function ($action) {
390
                $table = $action->getTable();
391
                $name = $table->getName();
392
393
                if (!isset($this->tableMoves[$name])) {
394
                    $this->tableMoves[$name] = new AlterTable($table);
395
                }
396
397
                $this->tableMoves[$name]->addAction($action);
398
            });
399
    }
400
401
    /**
@@ 419-428 (lines=10) @@
416
                // so we don't wan't them here too
417
                return isset($this->tableCreates[$action->getTable()->getName()]);
418
            })
419
            ->each(function ($action) {
420
                $table = $action->getTable();
421
                $name = $table->getName();
422
423
                if (!isset($this->indexes[$name])) {
424
                    $this->indexes[$name] = new AlterTable($table);
425
                }
426
427
                $this->indexes[$name]->addAction($action);
428
            });
429
    }
430
431
    /**
@@ 444-453 (lines=10) @@
441
                return $action instanceof AddForeignKey
442
                    || $action instanceof DropForeignKey;
443
            })
444
            ->each(function ($action) {
445
                $table = $action->getTable();
446
                $name = $table->getName();
447
448
                if (!isset($this->constraints[$name])) {
449
                    $this->constraints[$name] = new AlterTable($table);
450
                }
451
452
                $this->constraints[$name]->addAction($action);
453
            });
454
    }
455
}
456