Code Duplication    Length = 10-12 lines in 4 locations

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

@@ 599-608 (lines=10) @@
596
    /**
597
     * {@inheritdoc}
598
     */
599
    public function hasIndexByName($tableName, $indexName)
600
    {
601
        $indexes = $this->getIndexes($tableName);
602
        foreach ($indexes as $name => $index) {
603
            if ($name === $indexName) {
604
                return true;
605
            }
606
        }
607
608
        return false;
609
    }
610
611
    /**

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

@@ 679-690 (lines=12) @@
676
    /**
677
     * {@inheritdoc}
678
     */
679
    public function hasIndexByName($tableName, $indexName)
680
    {
681
        $indexes = $this->getIndexes($tableName);
682
683
        foreach ($indexes as $name => $index) {
684
            if ($name === $indexName) {
685
                 return true;
686
            }
687
        }
688
689
        return false;
690
    }
691
692
    /**
693
     * {@inheritdoc}

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

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

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

@@ 623-634 (lines=12) @@
620
    /**
621
     * {@inheritdoc}
622
     */
623
    public function hasIndexByName($tableName, $indexName)
624
    {
625
        $indexes = $this->getIndexes($tableName);
626
627
        foreach ($indexes as $index) {
628
            if ($indexName === $index['index']) {
629
                return true;
630
            }
631
        }
632
633
        return false;
634
    }
635
636
    /**
637
     * {@inheritdoc}