Code Duplication    Length = 12-12 lines in 3 locations

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

@@ 224-235 (lines=12) @@
221
        }
222
223
         // set the primary key(s)
224
        if (isset($options['primary_key'])) {
225
            $sql = rtrim($sql);
226
            $sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey'));
227
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
228
                $sql .= $this->quoteColumnName($options['primary_key']);
229
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
230
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
231
            }
232
            $sql .= ')';
233
        } else {
234
            $sql = rtrim($sql, ', '); // no primary keys
235
        }
236
237
        $sql .= ');';
238

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

@@ 277-288 (lines=12) @@
274
        }
275
276
        // set the primary key(s)
277
        if (isset($options['primary_key'])) {
278
            $sql = rtrim($sql);
279
            $sql .= ' PRIMARY KEY (';
280
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
281
                $sql .= $this->quoteColumnName($options['primary_key']);
282
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
283
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
284
            }
285
            $sql .= ')';
286
        } else {
287
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
288
        }
289
290
        // set the indexes
291
        foreach ($indexes as $index) {

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

@@ 262-273 (lines=12) @@
259
        }
260
261
        // set the primary key(s)
262
        if (isset($options['primary_key'])) {
263
            $sql = rtrim($sql);
264
            $sql .= ' PRIMARY KEY (';
265
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
266
                $sql .= $this->quoteColumnName($options['primary_key']);
267
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
268
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
269
            }
270
            $sql .= ')';
271
        } else {
272
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
273
        }
274
275
        $sql = rtrim($sql) . ');';
276
        // execute the sql