Code Duplication    Length = 10-12 lines in 4 locations

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

@@ 507-518 (lines=12) @@
504
    /**
505
     * {@inheritdoc}
506
     */
507
    public function hasIndexByName($tableName, $indexName)
508
    {
509
        $indexes = $this->getIndexes($tableName);
510
511
        foreach ($indexes as $name => $index) {
512
            if ($name === $indexName) {
513
                return true;
514
            }
515
        }
516
517
        return false;
518
    }
519
520
    /**
521
     * {@inheritdoc}

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

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

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

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

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

@@ 584-593 (lines=10) @@
581
    /**
582
     * {@inheritdoc}
583
     */
584
    public function hasIndexByName($tableName, $indexName)
585
    {
586
        $indexes = $this->getIndexes($tableName);
587
        foreach ($indexes as $name => $index) {
588
            if ($name === $indexName) {
589
                return true;
590
            }
591
        }
592
593
        return false;
594
    }
595
596
    /**