Code Duplication    Length = 10-12 lines in 4 locations

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

@@ 662-671 (lines=10) @@
659
    /**
660
     * {@inheritdoc}
661
     */
662
    public function hasIndexByName($tableName, $indexName)
663
    {
664
        $indexes = $this->getIndexes($tableName);
665
        foreach ($indexes as $name => $index) {
666
            if ($name === $indexName) {
667
                return true;
668
            }
669
        }
670
671
        return false;
672
    }
673
674
    /**

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

@@ 728-739 (lines=12) @@
725
    /**
726
     * {@inheritdoc}
727
     */
728
    public function hasIndexByName($tableName, $indexName)
729
    {
730
        $indexes = $this->getIndexes($tableName);
731
732
        foreach ($indexes as $name => $index) {
733
            if ($name === $indexName) {
734
                 return true;
735
            }
736
        }
737
738
        return false;
739
    }
740
741
    /**
742
     * {@inheritdoc}

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

@@ 558-569 (lines=12) @@
555
    /**
556
     * {@inheritdoc}
557
     */
558
    public function hasIndexByName($tableName, $indexName)
559
    {
560
        $indexes = $this->getIndexes($tableName);
561
562
        foreach ($indexes as $name => $index) {
563
            if ($name === $indexName) {
564
                return true;
565
            }
566
        }
567
568
        return false;
569
    }
570
571
    /**
572
     * {@inheritdoc}

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

@@ 663-674 (lines=12) @@
660
    /**
661
     * {@inheritdoc}
662
     */
663
    public function hasIndexByName($tableName, $indexName)
664
    {
665
        $indexes = $this->getIndexes($tableName);
666
667
        foreach ($indexes as $index) {
668
            if ($indexName === $index['index']) {
669
                return true;
670
            }
671
        }
672
673
        return false;
674
    }
675
676
    /**
677
     * {@inheritdoc}