Code Duplication    Length = 18-18 lines in 3 locations

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

@@ 731-748 (lines=18) @@
728
    /**
729
     * {@inheritdoc}
730
     */
731
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
732
    {
733
        $primaryKey = $this->getPrimaryKey($tableName);
734
735
        if (empty($primaryKey)) {
736
            return false;
737
        }
738
739
        if ($constraint) {
740
            return ($primaryKey['constraint'] === $constraint);
741
        } else {
742
            if (is_string($columns)) {
743
                $columns = [$columns]; // str to array
744
            }
745
            $missingColumns = array_diff($columns, $primaryKey['columns']);
746
747
            return empty($missingColumns);
748
        }
749
    }
750
751
    /**

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

@@ 812-829 (lines=18) @@
809
    /**
810
     * {@inheritdoc}
811
     */
812
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
813
    {
814
        $primaryKey = $this->getPrimaryKey($tableName);
815
816
        if (empty($primaryKey)) {
817
            return false;
818
        }
819
820
        if ($constraint) {
821
            return ($primaryKey['constraint'] === $constraint);
822
        } else {
823
            if (is_string($columns)) {
824
                $columns = [$columns]; // str to array
825
            }
826
            $missingColumns = array_diff($columns, $primaryKey['columns']);
827
828
            return empty($missingColumns);
829
        }
830
    }
831
832
    /**

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

@@ 653-670 (lines=18) @@
650
    /**
651
     * {@inheritdoc}
652
     */
653
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
654
    {
655
        $primaryKey = $this->getPrimaryKey($tableName);
656
657
        if (empty($primaryKey['constraint'])) {
658
            return false;
659
        }
660
661
        if ($constraint) {
662
            return ($primaryKey['constraint'] === $constraint);
663
        } else {
664
            if (is_string($columns)) {
665
                $columns = [$columns]; // str to array
666
            }
667
            $missingColumns = array_diff($columns, $primaryKey['columns']);
668
669
            return empty($missingColumns);
670
        }
671
    }
672
673
    /**