Code Duplication    Length = 13-17 lines in 2 locations

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

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

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

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