Code Duplication    Length = 18-18 lines in 3 locations

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

@@ 684-701 (lines=18) @@
681
    /**
682
     * {@inheritdoc}
683
     */
684
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
685
    {
686
        $primaryKey = $this->getPrimaryKey($tableName);
687
688
        if (empty($primaryKey['constraint'])) {
689
            return false;
690
        }
691
692
        if ($constraint) {
693
            return ($primaryKey['constraint'] === $constraint);
694
        } else {
695
            if (is_string($columns)) {
696
                $columns = [$columns]; // str to array
697
            }
698
            $missingColumns = array_diff($columns, $primaryKey['columns']);
699
700
            return empty($missingColumns);
701
        }
702
    }
703
704
    /**

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

@@ 755-772 (lines=18) @@
752
    /**
753
     * {@inheritdoc}
754
     */
755
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
756
    {
757
        $primaryKey = $this->getPrimaryKey($tableName);
758
759
        if (empty($primaryKey)) {
760
            return false;
761
        }
762
763
        if ($constraint) {
764
            return ($primaryKey['constraint'] === $constraint);
765
        } else {
766
            if (is_string($columns)) {
767
                $columns = [$columns]; // str to array
768
            }
769
            $missingColumns = array_diff($columns, $primaryKey['columns']);
770
771
            return empty($missingColumns);
772
        }
773
    }
774
775
    /**

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

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