Code Duplication    Length = 13-17 lines in 2 locations

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

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

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

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