@@ -22,10 +22,10 @@ |
||
22 | 22 | $statement = []; |
23 | 23 | |
24 | 24 | $statement[] = 'FOREIGN KEY'; |
25 | - $statement[] = '(' . $this->table->driver()->identifier($this->column) . ')'; |
|
25 | + $statement[] = '('.$this->table->driver()->identifier($this->column).')'; |
|
26 | 26 | |
27 | - $statement[] = 'REFERENCES ' . $this->table->driver()->identifier($this->foreignTable); |
|
28 | - $statement[] = '(' . $this->table->driver()->identifier($this->foreignKey) . ')'; |
|
27 | + $statement[] = 'REFERENCES '.$this->table->driver()->identifier($this->foreignTable); |
|
28 | + $statement[] = '('.$this->table->driver()->identifier($this->foreignKey).')'; |
|
29 | 29 | |
30 | 30 | $statement[] = "ON DELETE {$this->deleteRule}"; |
31 | 31 | $statement[] = "ON UPDATE {$this->updateRule}"; |
@@ -163,7 +163,7 @@ |
||
163 | 163 | { |
164 | 164 | //Temporary table is required to copy data over |
165 | 165 | $temporary = clone $this; |
166 | - $temporary->setName('spiral_temp_' . $this->getName() . '_' . uniqid()); |
|
166 | + $temporary->setName('spiral_temp_'.$this->getName().'_'.uniqid()); |
|
167 | 167 | |
168 | 168 | //We don't need any index in temporary table |
169 | 169 | foreach ($temporary->getIndexes() as $index) { |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | $selectColumns[] = "? AS {$this->quote($column)}"; |
36 | 36 | } |
37 | 37 | |
38 | - $statement[] = 'SELECT ' . implode(', ', $selectColumns); |
|
38 | + $statement[] = 'SELECT '.implode(', ', $selectColumns); |
|
39 | 39 | } else { |
40 | - $statement[] = 'UNION SELECT ' . trim(str_repeat('?, ', count($columns)), ', '); |
|
40 | + $statement[] = 'UNION SELECT '.trim(str_repeat('?, ', count($columns)), ', '); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $statement = ''; |
59 | 59 | |
60 | 60 | if (!empty($limit) || !empty($offset)) { |
61 | - $statement = 'LIMIT ' . ($limit ?: '-1') . ' '; |
|
61 | + $statement = 'LIMIT '.($limit ?: '-1').' '; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | if (!empty($offset)) { |
@@ -189,14 +189,14 @@ |
||
189 | 189 | if ($this->abstractType() == 'enum') { |
190 | 190 | |
191 | 191 | //Fetching enum values |
192 | - $this->enumValues = array_map(function ($value) { |
|
192 | + $this->enumValues = array_map(function($value) { |
|
193 | 193 | return trim($value, $value[0]); |
194 | 194 | }, explode(',', $options)); |
195 | 195 | |
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - $options = array_map(function ($value) { |
|
199 | + $options = array_map(function($value) { |
|
200 | 200 | return intval($value); |
201 | 201 | }, explode(',', $options)); |
202 | 202 |
@@ -92,6 +92,6 @@ |
||
92 | 92 | throw new SchemaException('MySQL commander can process only MySQL tables'); |
93 | 93 | } |
94 | 94 | |
95 | - return parent::createStatement($table) . " ENGINE {$table->getEngine()}"; |
|
95 | + return parent::createStatement($table)." ENGINE {$table->getEngine()}"; |
|
96 | 96 | } |
97 | 97 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $statement = ''; |
55 | 55 | if (!empty($limit) || !empty($offset)) { |
56 | 56 | //When limit is not provided but offset does we can replace limit value with PHP_INT_MAX |
57 | - $statement = 'LIMIT ' . ($limit ?: '18446744073709551615') . ' '; |
|
57 | + $statement = 'LIMIT '.($limit ?: '18446744073709551615').' '; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!empty($offset)) { |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function identifier($identifier) |
59 | 59 | { |
60 | - return $identifier == '*' ? '*' : '`' . str_replace('`', '``', $identifier) . '`'; |
|
60 | + return $identifier == '*' ? '*' : '`'.str_replace('`', '``', $identifier).'`'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | return "$statement CONSTRAINT {$this->enumConstraint(true, true)} " |
199 | - . "CHECK ({$this->getName(true)} IN (" . implode(', ', $enumValues) . '))'; |
|
199 | + . "CHECK ({$this->getName(true)} IN (".implode(', ', $enumValues).'))'; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | if ($original->abstractType() == 'enum' && !empty($this->enumConstraint)) { |
243 | - $operations[] = 'DROP CONSTRAINT ' . $this->enumConstraint(true); |
|
243 | + $operations[] = 'DROP CONSTRAINT '.$this->enumConstraint(true); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if ($original->defaultValue != $this->defaultValue) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | if ($original->nullable != $this->nullable) { |
255 | 255 | $operations[] = "ALTER COLUMN {$this->getName(true)} " |
256 | - . (!$this->nullable ? 'SET' : 'DROP') . ' NOT NULL'; |
|
256 | + . (!$this->nullable ? 'SET' : 'DROP').' NOT NULL'; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | if ($this->abstractType() == 'enum') { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | $operations[] = "ADD CONSTRAINT {$this->enumConstraint(true)} " |
266 | - . "CHECK ({$this->getName(true)} IN (" . implode(', ', $enumValues) . '))'; |
|
266 | + . "CHECK ({$this->getName(true)} IN (".implode(', ', $enumValues).'))'; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | return $operations; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected function prepareEnum() |
329 | 329 | { |
330 | - return '(' . $this->size . ')'; |
|
330 | + return '('.$this->size.')'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | { |
344 | 344 | if (empty($this->enumConstraint)) { |
345 | 345 | if ($temporary) { |
346 | - return $this->table->getName() . '_' . $this->getName() . '_enum'; |
|
346 | + return $this->table->getName().'_'.$this->getName().'_enum'; |
|
347 | 347 | } |
348 | 348 | |
349 | - $this->enumConstraint = $this->table->getName() . '_' . $this->getName() . '_enum_' . uniqid(); |
|
349 | + $this->enumConstraint = $this->table->getName().'_'.$this->getName().'_enum_'.uniqid(); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | return $quote ? $this->table->driver()->identifier($this->enumConstraint) : $this->enumConstraint; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | private function resolveNativeEnum() |
378 | 378 | { |
379 | 379 | $range = $this->table->driver()->query( |
380 | - 'SELECT enum_range(NULL::' . $this->type . ')' |
|
380 | + 'SELECT enum_range(NULL::'.$this->type.')' |
|
381 | 381 | )->fetchColumn(0); |
382 | 382 | |
383 | 383 | $this->enumValues = explode(',', substr($range, 1, -1)); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | . "WHERE conrelid = ? AND contype = 'c' AND (consrc LIKE ? OR consrc LIKE ?)"; |
404 | 404 | |
405 | 405 | $constraints = $this->table->driver()->query( |
406 | - $query, [$tableOID, '(' . $this->name . '%', '("' . $this->name . '%'] |
|
406 | + $query, [$tableOID, '('.$this->name.'%', '("'.$this->name.'%'] |
|
407 | 407 | ); |
408 | 408 | |
409 | 409 | foreach ($constraints as $constraint) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $table, |
25 | 25 | $columns, |
26 | 26 | $rowsets |
27 | - ) . (!empty($primaryKey) ? ' RETURNING ' . $this->quote($primaryKey) : ''); |
|
27 | + ).(!empty($primaryKey) ? ' RETURNING '.$this->quote($primaryKey) : ''); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,6 +36,6 @@ discard block |
||
36 | 36 | return ''; |
37 | 37 | } |
38 | 38 | |
39 | - return 'DISTINCT' . (is_string($distinct) ? '(' . $this->quote($distinct) . ')' : ''); |
|
39 | + return 'DISTINCT'.(is_string($distinct) ? '('.$this->quote($distinct).')' : ''); |
|
40 | 40 | } |
41 | 41 | } |