Code Duplication    Length = 18-18 lines in 3 locations

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

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

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

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

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

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