Code Duplication    Length = 11-11 lines in 6 locations

source/Spiral/Database/Entities/AbstractHandler.php 6 locations

@@ 448-458 (lines=11) @@
445
     * @param AbstractTable   $table
446
     * @param StateComparator $comparator
447
     */
448
    protected function createForeigns(AbstractTable $table, StateComparator $comparator)
449
    {
450
        foreach ($comparator->addedForeigns() as $foreign) {
451
            $this->log('Adding foreign key [{statement}] into table {table}.', [
452
                'statement' => $foreign->sqlStatement($this->driver),
453
                'table'     => $this->identify($table),
454
            ]);
455
456
            $this->createForeign($table, $foreign);
457
        }
458
    }
459
460
    /**
461
     * @param AbstractTable   $table
@@ 487-497 (lines=11) @@
484
     * @param AbstractTable   $table
485
     * @param StateComparator $comparator
486
     */
487
    protected function createIndexes(AbstractTable $table, StateComparator $comparator)
488
    {
489
        foreach ($comparator->addedIndexes() as $index) {
490
            $this->log('Adding index [{statement}] into table {table}.', [
491
                'statement' => $index->sqlStatement($this->driver),
492
                'table'     => $this->identify($table),
493
            ]);
494
495
            $this->createIndex($table, $index);
496
        }
497
    }
498
499
    /**
500
     * @param AbstractTable   $table
@@ 526-536 (lines=11) @@
523
     * @param AbstractTable   $table
524
     * @param StateComparator $comparator
525
     */
526
    protected function createColumns(AbstractTable $table, StateComparator $comparator)
527
    {
528
        foreach ($comparator->addedColumns() as $column) {
529
            $this->log('Adding column [{statement}] into table {table}.', [
530
                'statement' => $column->sqlStatement($this->driver),
531
                'table'     => $this->identify($table),
532
            ]);
533
534
            $this->createColumn($table, $column);
535
        }
536
    }
537
538
    /**
539
     * @param AbstractTable   $table
@@ 542-552 (lines=11) @@
539
     * @param AbstractTable   $table
540
     * @param StateComparator $comparator
541
     */
542
    protected function dropColumns(AbstractTable $table, StateComparator $comparator)
543
    {
544
        foreach ($comparator->droppedColumns() as $column) {
545
            $this->log('Dropping column [{statement}] from table {table}.', [
546
                'statement' => $column->sqlStatement($this->driver),
547
                'table'     => $this->identify($table),
548
            ]);
549
550
            $this->dropColumn($table, $column);
551
        }
552
    }
553
554
    /**
555
     * @param AbstractTable   $table
@@ 558-568 (lines=11) @@
555
     * @param AbstractTable   $table
556
     * @param StateComparator $comparator
557
     */
558
    protected function dropIndexes(AbstractTable $table, StateComparator $comparator)
559
    {
560
        foreach ($comparator->droppedIndexes() as $index) {
561
            $this->log('Dropping index [{statement}] from table {table}.', [
562
                'statement' => $index->sqlStatement($this->driver),
563
                'table'     => $this->identify($table),
564
            ]);
565
566
            $this->dropIndex($table, $index);
567
        }
568
    }
569
570
    /**
571
     * @param AbstractTable   $table
@@ 574-584 (lines=11) @@
571
     * @param AbstractTable   $table
572
     * @param StateComparator $comparator
573
     */
574
    protected function dropForeigns(AbstractTable $table, $comparator)
575
    {
576
        foreach ($comparator->droppedForeigns() as $foreign) {
577
            $this->log('Dropping foreign key [{statement}] from table {table}.', [
578
                'statement' => $foreign->sqlStatement($this->driver),
579
                'table'     => $this->identify($table),
580
            ]);
581
582
            $this->dropForeign($table, $foreign);
583
        }
584
    }
585
}