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

@@ 334-345 (lines=12) @@
331
        }
332
333
        // set the primary key(s)
334
        if (isset($options['primary_key'])) {
335
            $sql = rtrim($sql);
336
            $sql .= ' PRIMARY KEY (';
337
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
338
                $sql .= $this->quoteColumnName($options['primary_key']);
339
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
340
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
341
            }
342
            $sql .= ')';
343
        } else {
344
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
345
        }
346
347
        $sql = rtrim($sql) . ');';
348
        // execute the sql