Code Duplication    Length = 18-18 lines in 3 locations

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

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

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

@@ 822-839 (lines=18) @@
819
    /**
820
     * {@inheritdoc}
821
     */
822
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
823
    {
824
        $primaryKey = $this->getPrimaryKey($tableName);
825
826
        if (empty($primaryKey)) {
827
            return false;
828
        }
829
830
        if ($constraint) {
831
            return ($primaryKey['constraint'] === $constraint);
832
        } else {
833
            if (is_string($columns)) {
834
                $columns = [$columns]; // str to array
835
            }
836
            $missingColumns = array_diff($columns, $primaryKey['columns']);
837
838
            return empty($missingColumns);
839
        }
840
    }
841
842
    /**

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

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