Code Duplication    Length = 15-15 lines in 2 locations

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

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

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

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