Code Duplication    Length = 13-17 lines in 2 locations

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

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

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

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