Code Duplication    Length = 14-19 lines in 3 locations

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

@@ 530-543 (lines=14) @@
527
    /**
528
     * {@inheritdoc}
529
     */
530
    public function hasIndex($tableName, $columns)
531
    {
532
        if (is_string($columns)) {
533
            $columns = [$columns];
534
        }
535
        $columns = array_map('strtolower', $columns);
536
        $indexes = $this->getIndexes($tableName);
537
        foreach ($indexes as $index) {
538
            if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) {
539
                return true;
540
            }
541
        }
542
543
        return false;
544
    }
545
546
    /**

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

@@ 644-662 (lines=19) @@
641
    /**
642
     * {@inheritdoc}
643
     */
644
    public function hasIndex($tableName, $columns)
645
    {
646
        if (is_string($columns)) {
647
            $columns = [$columns]; // str to array
648
        }
649
650
        $columns = array_map('strtolower', $columns);
651
        $indexes = $this->getIndexes($tableName);
652
653
        foreach ($indexes as $index) {
654
            $a = array_diff($columns, $index['columns']);
655
656
            if (empty($a)) {
657
                return true;
658
            }
659
        }
660
661
        return false;
662
    }
663
664
    /**
665
     * {@inheritdoc}

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

@@ 519-536 (lines=18) @@
516
    /**
517
     * {@inheritdoc}
518
     */
519
    public function hasIndex($tableName, $columns)
520
    {
521
        if (is_string($columns)) {
522
            $columns = [$columns]; // str to array
523
        }
524
525
        $columns = array_map('strtolower', $columns);
526
        $indexes = $this->getIndexes($tableName);
527
528
        foreach ($indexes as $index) {
529
            $a = array_diff($columns, $index['columns']);
530
            if (empty($a)) {
531
                return true;
532
            }
533
        }
534
535
        return false;
536
    }
537
538
    /**
539
     * {@inheritdoc}