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/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}

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

@@ 564-573 (lines=10) @@
561
     /**
562
      * {@inheritdoc}
563
      */
564
    public function hasIndexByName($tableName, $indexName)
565
    {
566
        $indexes = $this->getIndexes($tableName);
567
        foreach ($indexes as $name => $index) {
568
            if ($name === $indexName) {
569
                return true;
570
            }
571
        }
572
        return false;
573
    }
574
575
    /**
576
     * {@inheritdoc}