Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 1009-1024 (lines=16) @@
1006
     * @param string     $tableName  Table name
1007
     * @return string
1008
     */
1009
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName)
1010
    {
1011
        $constraintName = $foreignKey->getConstraint()
1012
            ? $foreignKey->getConstraint()
1013
            : $tableName . '_' . implode('_', $foreignKey->getColumns());
1014
1015
        $def = ' CONSTRAINT "' . $constraintName . '" FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")';
1016
        $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")';
1017
        if ($foreignKey->getOnDelete()) {
1018
            $def .= " ON DELETE {$foreignKey->getOnDelete()}";
1019
        }
1020
        if ($foreignKey->getOnUpdate()) {
1021
            $def .= " ON UPDATE {$foreignKey->getOnUpdate()}";
1022
        }
1023
1024
        return $def;
1025
    }
1026
1027
    /**

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

@@ 1098-1114 (lines=17) @@
1095
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1096
     * @return string
1097
     */
1098
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName)
1099
    {
1100
        $constraintName = $foreignKey->getConstraint()
1101
            ? $foreignKey->getConstraint()
1102
            : $tableName . '_' . implode('_', $foreignKey->getColumns());
1103
        $def = ' CONSTRAINT ' . $this->quoteColumnName($constraintName);
1104
        $def .= ' FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")';
1105
        $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")';
1106
        if ($foreignKey->getOnDelete()) {
1107
            $def .= " ON DELETE {$foreignKey->getOnDelete()}";
1108
        }
1109
        if ($foreignKey->getOnUpdate()) {
1110
            $def .= " ON UPDATE {$foreignKey->getOnUpdate()}";
1111
        }
1112
1113
        return $def;
1114
    }
1115
1116
    /**
1117
     * {@inheritdoc}