Code Duplication    Length = 10-12 lines in 4 locations

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

@@ 521-532 (lines=12) @@
518
    /**
519
     * {@inheritdoc}
520
     */
521
    public function hasIndexByName($tableName, $indexName)
522
    {
523
        $indexes = $this->getIndexes($tableName);
524
525
        foreach ($indexes as $name => $index) {
526
            if ($name === $indexName) {
527
                 return true;
528
            }
529
        }
530
531
        return false;
532
    }
533
534
    /**
535
     * {@inheritdoc}

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

@@ 546-555 (lines=10) @@
543
     /**
544
      * {@inheritdoc}
545
      */
546
    public function hasIndexByName($tableName, $indexName)
547
    {
548
        $indexes = $this->getIndexes($tableName);
549
        foreach ($indexes as $name => $index) {
550
            if ($name === $indexName) {
551
                return true;
552
            }
553
        }
554
        return false;
555
    }
556
557
    /**
558
     * {@inheritdoc}

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

@@ 543-554 (lines=12) @@
540
    /**
541
     * {@inheritdoc}
542
     */
543
    public function hasIndexByName($tableName, $indexName)
544
    {
545
        $indexes = $this->getIndexes($tableName);
546
547
        foreach ($indexes as $index) {
548
            if ($indexName === $index['index']) {
549
                return true;
550
            }
551
        }
552
553
        return false;
554
    }
555
556
    /**
557
     * {@inheritdoc}

src/Phinx/Db/Adapter/SqlServerAdapter.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 $name => $index) {
668
            if ($name === $indexName) {
669
                 return true;
670
            }
671
        }
672
673
        return false;
674
    }
675
676
    /**
677
     * {@inheritdoc}