Code Duplication    Length = 28-29 lines in 2 locations

source/Spiral/Database/Entities/Schemas/AbstractTable.php 2 locations

@@ 608-636 (lines=29) @@
605
     *
606
     * @return $this
607
     */
608
    protected function synchroniseIndexes()
609
    {
610
        foreach ($this->comparator->addedIndexes() as $index) {
611
            $this->logger()->debug("Adding index [{statement}] into table {table}.", [
612
                'statement' => $index->sqlStatement(),
613
                'table'     => $this->getName(true)
614
            ]);
615
616
            $this->commander->addIndex($this, $index);
617
        }
618
619
        foreach ($this->comparator->alteredIndexes() as $pair) {
620
            /**
621
             * @var AbstractIndex $initial
622
             * @var AbstractIndex $current
623
             */
624
            list($current, $initial) = $pair;
625
626
            $this->logger()->debug("Altering index [{statement}] to [{new}] in table {table}.", [
627
                'statement' => $initial->sqlStatement(),
628
                'new'       => $current->sqlStatement(),
629
                'table'     => $this->getName(true)
630
            ]);
631
632
            $this->commander->alterIndex($this, $initial, $current);
633
        }
634
635
        return $this;
636
    }
637
638
    /**
639
     * Drop needed foreign keys.
@@ 662-689 (lines=28) @@
659
     *
660
     * @return $this
661
     */
662
    protected function synchroniseForeigns()
663
    {
664
        foreach ($this->comparator->addedForeigns() as $foreign) {
665
            $this->logger()->debug("Adding foreign key [{statement}] into table {table}.", [
666
                'statement' => $foreign->sqlStatement(),
667
                'table'     => $this->getName(true)
668
            ]);
669
670
            $this->commander->addForeign($this, $foreign);
671
        }
672
673
        foreach ($this->comparator->alteredForeigns() as $pair) {
674
            /**
675
             * @var AbstractReference $initial
676
             * @var AbstractReference $current
677
             */
678
            list($current, $initial) = $pair;
679
680
            $this->logger()->debug("Altering foreign key [{statement}] to [{new}] in {table}.", [
681
                'statement' => $initial->sqlStatement(),
682
                'table'     => $this->getName(true)
683
            ]);
684
685
            $this->commander->alterForeign($this, $initial, $current);
686
        }
687
688
        return $this;
689
    }
690
691
    /**
692
     * Driver specific column schema.