Code Duplication    Length = 28-29 lines in 2 locations

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

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