Code Duplication    Length = 10-12 lines in 4 locations

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

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

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

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

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

@@ 667-678 (lines=12) @@
664
    /**
665
     * {@inheritdoc}
666
     */
667
    public function hasIndexByName($tableName, $indexName)
668
    {
669
        $indexes = $this->getIndexes($tableName);
670
671
        foreach ($indexes as $name => $index) {
672
            if ($name === $indexName) {
673
                 return true;
674
            }
675
        }
676
677
        return false;
678
    }
679
680
    /**
681
     * {@inheritdoc}

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

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