Code Duplication    Length = 18-18 lines in 3 locations

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

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

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
    /**