Code Duplication    Length = 10-12 lines in 4 locations

src/Phinx/Db/Adapter/MysqlAdapter.php 1 location

@@ 606-617 (lines=12) @@
603
    /**
604
     * {@inheritdoc}
605
     */
606
    public function hasIndexByName($tableName, $indexName)
607
    {
608
        $indexes = $this->getIndexes($tableName);
609
610
        foreach ($indexes as $name => $index) {
611
            if ($name === $indexName) {
612
                return true;
613
            }
614
        }
615
616
        return false;
617
    }
618
619
    /**
620
     * {@inheritdoc}

src/Phinx/Db/Adapter/PostgresAdapter.php 1 location

@@ 687-696 (lines=10) @@
684
    /**
685
     * {@inheritdoc}
686
     */
687
    public function hasIndexByName($tableName, $indexName)
688
    {
689
        $indexes = $this->getIndexes($tableName);
690
        foreach ($indexes as $name => $index) {
691
            if ($name === $indexName) {
692
                return true;
693
            }
694
        }
695
696
        return false;
697
    }
698
699
    /**

src/Phinx/Db/Adapter/SQLiteAdapter.php 1 location

@@ 684-695 (lines=12) @@
681
    /**
682
     * {@inheritdoc}
683
     */
684
    public function hasIndexByName($tableName, $indexName)
685
    {
686
        $indexes = $this->getIndexes($tableName);
687
688
        foreach ($indexes as $index) {
689
            if ($indexName === $index['index']) {
690
                return true;
691
            }
692
        }
693
694
        return false;
695
    }
696
697
    /**
698
     * {@inheritdoc}

src/Phinx/Db/Adapter/SqlServerAdapter.php 1 location

@@ 752-763 (lines=12) @@
749
    /**
750
     * {@inheritdoc}
751
     */
752
    public function hasIndexByName($tableName, $indexName)
753
    {
754
        $indexes = $this->getIndexes($tableName);
755
756
        foreach ($indexes as $name => $index) {
757
            if ($name === $indexName) {
758
                 return true;
759
            }
760
        }
761
762
        return false;
763
    }
764
765
    /**
766
     * {@inheritdoc}