Code Duplication    Length = 13-17 lines in 2 locations

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

@@ 482-498 (lines=17) @@
479
    /**
480
     * {@inheritdoc}
481
     */
482
    public function hasIndex($tableName, $columns)
483
    {
484
        if (is_string($columns)) {
485
            $columns = [$columns]; // str to array
486
        }
487
488
        $columns = array_map('strtolower', $columns);
489
        $indexes = $this->getIndexes($tableName);
490
491
        foreach ($indexes as $index) {
492
            if ($columns == $index['columns']) {
493
                return true;
494
            }
495
        }
496
497
        return false;
498
    }
499
500
    /**
501
     * {@inheritdoc}

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

@@ 581-593 (lines=13) @@
578
    /**
579
     * {@inheritdoc}
580
     */
581
    public function hasIndex($tableName, $columns)
582
    {
583
        if (is_string($columns)) {
584
            $columns = [$columns];
585
        }
586
        $indexes = $this->getIndexes($tableName);
587
        foreach ($indexes as $index) {
588
            if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) {
589
                return true;
590
            }
591
        }
592
593
        return false;
594
    }
595
596
    /**