Code Duplication    Length = 10-12 lines in 4 locations

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
573
        return false;
574
    }
575
576
    /**

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

@@ 532-543 (lines=12) @@
529
    /**
530
     * {@inheritdoc}
531
     */
532
    public function hasIndexByName($tableName, $indexName)
533
    {
534
        $indexes = $this->getIndexes($tableName);
535
536
        foreach ($indexes as $index) {
537
            if ($indexName === $index['index']) {
538
                return true;
539
            }
540
        }
541
542
        return false;
543
    }
544
545
    /**
546
     * {@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}