Code Duplication    Length = 18-18 lines in 3 locations

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

@@ 840-857 (lines=18) @@
837
    /**
838
     * @inheritDoc
839
     */
840
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
841
    {
842
        $primaryKey = $this->getPrimaryKey($tableName);
843
844
        if (empty($primaryKey)) {
845
            return false;
846
        }
847
848
        if ($constraint) {
849
            return ($primaryKey['constraint'] === $constraint);
850
        } else {
851
            if (is_string($columns)) {
852
                $columns = [$columns]; // str to array
853
            }
854
            $missingColumns = array_diff($columns, $primaryKey['columns']);
855
856
            return empty($missingColumns);
857
        }
858
    }
859
860
    /**

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

@@ 671-688 (lines=18) @@
668
    /**
669
     * @inheritDoc
670
     */
671
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
672
    {
673
        $primaryKey = $this->getPrimaryKey($tableName);
674
675
        if (empty($primaryKey['constraint'])) {
676
            return false;
677
        }
678
679
        if ($constraint) {
680
            return ($primaryKey['constraint'] === $constraint);
681
        } else {
682
            if (is_string($columns)) {
683
                $columns = [$columns]; // str to array
684
            }
685
            $missingColumns = array_diff($columns, $primaryKey['columns']);
686
687
            return empty($missingColumns);
688
        }
689
    }
690
691
    /**

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

@@ 745-762 (lines=18) @@
742
    /**
743
     * @inheritDoc
744
     */
745
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
746
    {
747
        $primaryKey = $this->getPrimaryKey($tableName);
748
749
        if (empty($primaryKey)) {
750
            return false;
751
        }
752
753
        if ($constraint) {
754
            return ($primaryKey['constraint'] === $constraint);
755
        } else {
756
            if (is_string($columns)) {
757
                $columns = [$columns]; // str to array
758
            }
759
            $missingColumns = array_diff($columns, $primaryKey['columns']);
760
761
            return empty($missingColumns);
762
        }
763
    }
764
765
    /**