Code Duplication    Length = 13-17 lines in 2 locations

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

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

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

@@ 502-518 (lines=17) @@
499
    /**
500
     * {@inheritdoc}
501
     */
502
    public function hasIndex($tableName, $columns)
503
    {
504
        if (is_string($columns)) {
505
            $columns = [$columns]; // str to array
506
        }
507
508
        $columns = array_map('strtolower', $columns);
509
        $indexes = $this->getIndexes($tableName);
510
511
        foreach ($indexes as $index) {
512
            if ($columns == $index['columns']) {
513
                return true;
514
            }
515
        }
516
517
        return false;
518
    }
519
520
    /**
521
     * {@inheritdoc}