@@ -90,10 +90,10 @@ |
||
90 | 90 | throw new TableHasNotDefinedException('table not defined'); |
91 | 91 | } |
92 | 92 | if ($this->isPrimary()) { |
93 | - return [sprintf('ALTER TABLE `%s` ADD PRIMARY KEY (%s);', $this->getTable(), '`' . implode('`, `', $this->getColumns()) . '`')]; |
|
93 | + return [sprintf('ALTER TABLE `%s` ADD PRIMARY KEY (%s);', $this->getTable(), '`'.implode('`, `', $this->getColumns()).'`')]; |
|
94 | 94 | } |
95 | 95 | |
96 | - return [sprintf('ALTER TABLE `%s` ADD %s INDEX `%s` (%s);', $this->getTable(), $this->getIndexType(), $this->getName(), '`' . implode('`, `', $this->getColumns()) . '`')]; |
|
96 | + return [sprintf('ALTER TABLE `%s` ADD %s INDEX `%s` (%s);', $this->getTable(), $this->getIndexType(), $this->getName(), '`'.implode('`, `', $this->getColumns()).'`')]; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $isEnum = explode('enum', $this->type); |
54 | 54 | if ($isEnum) { |
55 | - $numberElements = substr_count(str_replace(['(', ')', "'",], '', $isEnum[1]), ',') + 1; |
|
55 | + $numberElements = substr_count(str_replace(['(', ')', "'", ], '', $isEnum[1]), ',') + 1; |
|
56 | 56 | if ($numberElements == 2) { |
57 | 57 | $this->type = 'tinyint'; |
58 | 58 | $this->length = 1; |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | throw new TableHasNotDefinedException('table not defined'); |
93 | 93 | } |
94 | 94 | $null = $this->getNullable() ? '' : 'NOT'; |
95 | - $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue(); |
|
95 | + $default = $this->getDefaultValue() == false ? '' : ' DEFAULT '.$this->getDefaultValue(); |
|
96 | 96 | $modification = sprintf('ALTER TABLE `%s` ADD COLUMN `%s` %s %s NULL %s %s;', $this->getTable(), $this->getName(), $this->getColonneType(), $null, $default, $this->getExtra()); |
97 | 97 | |
98 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
98 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $baseType = $this->type; |
133 | 133 | if (in_array($baseType, ['int', 'mediumint', 'tinyint', 'smallint', 'binary', 'varchar', 'bigint', 'char', 'float'], false)) { |
134 | - $baseType = $baseType . '(' . $this->length . ')'; |
|
134 | + $baseType = $baseType.'('.$this->length.')'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $baseType; |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | throw new TableHasNotDefinedException('table not defined'); |
165 | 165 | } |
166 | 166 | $null = $this->getNullable() ? '' : 'NOT'; |
167 | - $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue(); |
|
168 | - $columnName = '`' . $this->getName() . '`'; |
|
167 | + $default = $this->getDefaultValue() == false ? '' : ' DEFAULT '.$this->getDefaultValue(); |
|
168 | + $columnName = '`'.$this->getName().'`'; |
|
169 | 169 | $modification = sprintf('ALTER TABLE `%s` CHANGE COLUMN %s %s %s %s NULL %s %s;', $this->getTable(), $columnName, $columnName, $this->getColonneType(), $null, $default, $this->getExtra()); |
170 | 170 | |
171 | - return [str_replace([' ', ' ',], ' ', $modification)]; |
|
171 | + return [str_replace([' ', ' ', ], ' ', $modification)]; |
|
172 | 172 | } |
173 | 173 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | protected function addIndexType($indexName, $unique, array $columns) |
70 | 70 | { |
71 | 71 | if (empty($indexName)) { |
72 | - $indexName = ($unique ? 'UNI_' : 'IDX_') . md5(implode(',', $columns)); |
|
72 | + $indexName = ($unique ? 'UNI_' : 'IDX_').md5(implode(',', $columns)); |
|
73 | 73 | } |
74 | 74 | try { |
75 | 75 | $index = new MysqlDatabaseIndex($indexName, $columns, $unique); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | $statements = []; |
184 | 184 | foreach ($modificationsBetweenTable as $modifications) { |
185 | - foreach ((array)$modifications as $modification) { |
|
185 | + foreach ((array) $modifications as $modification) { |
|
186 | 186 | $statements[] = $modification; |
187 | 187 | } |
188 | 188 | } |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | } |
198 | 198 | $tmp = []; |
199 | 199 | foreach ($modifications as $modification) { |
200 | - $tmp[] = str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';',], '', $modification); |
|
200 | + $tmp[] = str_replace(['ALTER TABLE `'.$this->getTable().'` ADD COLUMN', 'ALTER TABLE `'.$this->getTable().'` ADD ', ';', ], '', $modification); |
|
201 | 201 | } |
202 | 202 | |
203 | - return ['(' . $finalStatement . implode(',', $tmp) . ');']; |
|
203 | + return ['('.$finalStatement.implode(',', $tmp).');']; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |