Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 1193-1216 (lines=24) @@
1190
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1191
     * @return string
1192
     */
1193
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1194
    {
1195
        $def = '';
1196
        if ($foreignKey->getConstraint()) {
1197
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1198
        }
1199
        $columnNames = [];
1200
        foreach ($foreignKey->getColumns() as $column) {
1201
            $columnNames[] = $this->quoteColumnName($column);
1202
        }
1203
        $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1204
        $refColumnNames = [];
1205
        foreach ($foreignKey->getReferencedColumns() as $column) {
1206
            $refColumnNames[] = $this->quoteColumnName($column);
1207
        }
1208
        $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1209
        if ($foreignKey->getOnDelete()) {
1210
            $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1211
        }
1212
        if ($foreignKey->getOnUpdate()) {
1213
            $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1214
        }
1215
1216
        return $def;
1217
    }
1218
1219
    /**

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

@@ 1243-1267 (lines=25) @@
1240
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1241
     * @return string
1242
     */
1243
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1244
    {
1245
        $def = '';
1246
        if ($foreignKey->getConstraint()) {
1247
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1248
        } else {
1249
            $columnNames = [];
1250
            foreach ($foreignKey->getColumns() as $column) {
1251
                $columnNames[] = $this->quoteColumnName($column);
1252
            }
1253
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1254
            $refColumnNames = [];
1255
            foreach ($foreignKey->getReferencedColumns() as $column) {
1256
                $refColumnNames[] = $this->quoteColumnName($column);
1257
            }
1258
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1259
            if ($foreignKey->getOnDelete()) {
1260
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1261
            }
1262
            if ($foreignKey->getOnUpdate()) {
1263
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1264
            }
1265
        }
1266
1267
        return $def;
1268
    }
1269
1270
    /**