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

@@ 1550-1574 (lines=25) @@
1547
     *
1548
     * @return string
1549
     */
1550
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1551
    {
1552
        $def = '';
1553
        if ($foreignKey->getConstraint()) {
1554
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1555
        } else {
1556
            $columnNames = [];
1557
            foreach ($foreignKey->getColumns() as $column) {
1558
                $columnNames[] = $this->quoteColumnName($column);
1559
            }
1560
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1561
            $refColumnNames = [];
1562
            foreach ($foreignKey->getReferencedColumns() as $column) {
1563
                $refColumnNames[] = $this->quoteColumnName($column);
1564
            }
1565
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1566
            if ($foreignKey->getOnDelete()) {
1567
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1568
            }
1569
            if ($foreignKey->getOnUpdate()) {
1570
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1571
            }
1572
        }
1573
1574
        return $def;
1575
    }
1576
1577
    /**