Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 1565-1589 (lines=25) @@
1562
     *
1563
     * @return string
1564
     */
1565
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1566
    {
1567
        $def = '';
1568
        if ($foreignKey->getConstraint()) {
1569
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1570
        } else {
1571
            $columnNames = [];
1572
            foreach ($foreignKey->getColumns() as $column) {
1573
                $columnNames[] = $this->quoteColumnName($column);
1574
            }
1575
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1576
            $refColumnNames = [];
1577
            foreach ($foreignKey->getReferencedColumns() as $column) {
1578
                $refColumnNames[] = $this->quoteColumnName($column);
1579
            }
1580
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1581
            if ($foreignKey->getOnDelete()) {
1582
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1583
            }
1584
            if ($foreignKey->getOnUpdate()) {
1585
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1586
            }
1587
        }
1588
1589
        return $def;
1590
    }
1591
1592
    /**

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

@@ 1256-1279 (lines=24) @@
1253
     *
1254
     * @return string
1255
     */
1256
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1257
    {
1258
        $def = '';
1259
        if ($foreignKey->getConstraint()) {
1260
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1261
        }
1262
        $columnNames = [];
1263
        foreach ($foreignKey->getColumns() as $column) {
1264
            $columnNames[] = $this->quoteColumnName($column);
1265
        }
1266
        $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1267
        $refColumnNames = [];
1268
        foreach ($foreignKey->getReferencedColumns() as $column) {
1269
            $refColumnNames[] = $this->quoteColumnName($column);
1270
        }
1271
        $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1272
        if ($foreignKey->getOnDelete()) {
1273
            $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1274
        }
1275
        if ($foreignKey->getOnUpdate()) {
1276
            $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1277
        }
1278
1279
        return $def;
1280
    }
1281
1282
    /**