Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 1088-1104 (lines=17) @@
1085
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1086
     * @return string
1087
     */
1088
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName)
1089
    {
1090
        $constraintName = $foreignKey->getConstraint()
1091
            ? $foreignKey->getConstraint()
1092
            : $tableName . '_' . implode('_', $foreignKey->getColumns());
1093
        $def = ' CONSTRAINT ' . $this->quoteColumnName($constraintName);
1094
        $def .= ' FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")';
1095
        $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")';
1096
        if ($foreignKey->getOnDelete()) {
1097
            $def .= " ON DELETE {$foreignKey->getOnDelete()}";
1098
        }
1099
        if ($foreignKey->getOnUpdate()) {
1100
            $def .= " ON UPDATE {$foreignKey->getOnUpdate()}";
1101
        }
1102
1103
        return $def;
1104
    }
1105
1106
    /**
1107
     * {@inheritdoc}

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

@@ 999-1014 (lines=16) @@
996
     * @param string     $tableName  Table name
997
     * @return string
998
     */
999
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName)
1000
    {
1001
        $constraintName = $foreignKey->getConstraint()
1002
            ? $foreignKey->getConstraint()
1003
            : $tableName . '_' . implode('_', $foreignKey->getColumns());
1004
1005
        $def = ' CONSTRAINT "' . $constraintName . '" FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")';
1006
        $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")';
1007
        if ($foreignKey->getOnDelete()) {
1008
            $def .= " ON DELETE {$foreignKey->getOnDelete()}";
1009
        }
1010
        if ($foreignKey->getOnUpdate()) {
1011
            $def .= " ON UPDATE {$foreignKey->getOnUpdate()}";
1012
        }
1013
1014
        return $def;
1015
    }
1016
1017
    /**