Code Duplication    Length = 10-12 lines in 4 locations

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

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

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/SQLiteAdapter.php 1 location

@@ 605-616 (lines=12) @@
602
    /**
603
     * {@inheritdoc}
604
     */
605
    public function hasIndexByName($tableName, $indexName)
606
    {
607
        $indexes = $this->getIndexes($tableName);
608
609
        foreach ($indexes as $index) {
610
            if ($indexName === $index['index']) {
611
                return true;
612
            }
613
        }
614
615
        return false;
616
    }
617
618
    /**
619
     * {@inheritdoc}

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}