Code Duplication    Length = 14-19 lines in 3 locations

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

@@ 561-574 (lines=14) @@
558
    /**
559
     * {@inheritdoc}
560
     */
561
    public function hasIndex($tableName, $columns)
562
    {
563
        if (is_string($columns)) {
564
            $columns = [$columns];
565
        }
566
        $columns = array_map('strtolower', $columns);
567
        $indexes = $this->getIndexes($tableName);
568
        foreach ($indexes as $index) {
569
            if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) {
570
                return true;
571
            }
572
        }
573
574
        return false;
575
    }
576
577
    /**

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

@@ 581-598 (lines=18) @@
578
    /**
579
     * {@inheritdoc}
580
     */
581
    public function hasIndex($tableName, $columns)
582
    {
583
        if (is_string($columns)) {
584
            $columns = [$columns]; // str to array
585
        }
586
587
        $columns = array_map('strtolower', $columns);
588
        $indexes = $this->getIndexes($tableName);
589
590
        foreach ($indexes as $index) {
591
            $a = array_diff($columns, $index['columns']);
592
            if (empty($a)) {
593
                return true;
594
            }
595
        }
596
597
        return false;
598
    }
599
600
    /**
601
     * {@inheritdoc}

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

@@ 654-672 (lines=19) @@
651
    /**
652
     * {@inheritdoc}
653
     */
654
    public function hasIndex($tableName, $columns)
655
    {
656
        if (is_string($columns)) {
657
            $columns = [$columns]; // str to array
658
        }
659
660
        $columns = array_map('strtolower', $columns);
661
        $indexes = $this->getIndexes($tableName);
662
663
        foreach ($indexes as $index) {
664
            $a = array_diff($columns, $index['columns']);
665
666
            if (empty($a)) {
667
                return true;
668
            }
669
        }
670
671
        return false;
672
    }
673
674
    /**
675
     * {@inheritdoc}