Code Duplication    Length = 18-18 lines in 3 locations

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

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

@@ 700-717 (lines=18) @@
697
    /**
698
     * {@inheritdoc}
699
     */
700
    public function hasPrimaryKey($tableName, $columns, $constraint = null)
701
    {
702
        $primaryKey = $this->getPrimaryKey($tableName);
703
704
        if (empty($primaryKey['constraint'])) {
705
            return false;
706
        }
707
708
        if ($constraint) {
709
            return ($primaryKey['constraint'] === $constraint);
710
        } else {
711
            if (is_string($columns)) {
712
                $columns = [$columns]; // str to array
713
            }
714
            $missingColumns = array_diff($columns, $primaryKey['columns']);
715
716
            return empty($missingColumns);
717
        }
718
    }
719
720
    /**