Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 1232-1255 (lines=24) @@
1229
     *
1230
     * @return string
1231
     */
1232
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1233
    {
1234
        $def = '';
1235
        if ($foreignKey->getConstraint()) {
1236
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1237
        }
1238
        $columnNames = [];
1239
        foreach ($foreignKey->getColumns() as $column) {
1240
            $columnNames[] = $this->quoteColumnName($column);
1241
        }
1242
        $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1243
        $refColumnNames = [];
1244
        foreach ($foreignKey->getReferencedColumns() as $column) {
1245
            $refColumnNames[] = $this->quoteColumnName($column);
1246
        }
1247
        $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1248
        if ($foreignKey->getOnDelete()) {
1249
            $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1250
        }
1251
        if ($foreignKey->getOnUpdate()) {
1252
            $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1253
        }
1254
1255
        return $def;
1256
    }
1257
1258
    /**

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

@@ 1534-1558 (lines=25) @@
1531
     *
1532
     * @return string
1533
     */
1534
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1535
    {
1536
        $def = '';
1537
        if ($foreignKey->getConstraint()) {
1538
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1539
        } else {
1540
            $columnNames = [];
1541
            foreach ($foreignKey->getColumns() as $column) {
1542
                $columnNames[] = $this->quoteColumnName($column);
1543
            }
1544
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1545
            $refColumnNames = [];
1546
            foreach ($foreignKey->getReferencedColumns() as $column) {
1547
                $refColumnNames[] = $this->quoteColumnName($column);
1548
            }
1549
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1550
            if ($foreignKey->getOnDelete()) {
1551
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1552
            }
1553
            if ($foreignKey->getOnUpdate()) {
1554
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1555
            }
1556
        }
1557
1558
        return $def;
1559
    }
1560
1561
    /**