Code Duplication    Length = 12-12 lines in 3 locations

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

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

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_pkey PRIMARY KEY (', $table->getName());
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/SQLiteAdapter.php 1 location

@@ 209-220 (lines=12) @@
206
        }
207
208
        // set the primary key(s)
209
        if (isset($options['primary_key'])) {
210
            $sql = rtrim($sql);
211
            $sql .= ' PRIMARY KEY (';
212
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
213
                $sql .= $this->quoteColumnName($options['primary_key']);
214
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
215
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
216
            }
217
            $sql .= ')';
218
        } else {
219
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
220
        }
221
222
        $sql = rtrim($sql) . ');';
223
        // execute the sql