@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * @var array |
45 | 45 | */ |
46 | - protected $databases = []; |
|
46 | + protected $databases = [ ]; |
|
47 | 47 | /** |
48 | 48 | * @var string |
49 | 49 | */ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function registerDatabase($scheme, $className) |
77 | 77 | { |
78 | - $this->databases[$scheme] = $className; |
|
78 | + $this->databases[ $scheme ] = $className; |
|
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function getDatabaseClassName() |
114 | 114 | { |
115 | - if (isset($this->databases[$this->uri->getScheme()])) { |
|
116 | - return $this->databases[$this->uri->getScheme()]; |
|
115 | + if (isset($this->databases[ $this->uri->getScheme() ])) { |
|
116 | + return $this->databases[ $this->uri->getScheme() ]; |
|
117 | 117 | } |
118 | 118 | throw new DatabaseDoesNotRegistered( |
119 | 119 | 'Scheme "' . $this->uri->getScheme() . '" does not found. Did you registered it?' |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | . "/" . ($increment < 0 ? "down" : "up") |
154 | 154 | . "/*.sql"; |
155 | 155 | |
156 | - $result = array_filter(glob($filePattern), function ($file) use ($version) { |
|
156 | + $result = array_filter(glob($filePattern), function($file) use ($version) { |
|
157 | 157 | return preg_match("/^0*$version(-dev)?\.sql$/", basename($file)); |
158 | 158 | }); |
159 | 159 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | return $data; |
189 | 189 | } |
190 | 190 | |
191 | - $data["content"] = file_get_contents($file); |
|
191 | + $data[ "content" ] = file_get_contents($file); |
|
192 | 192 | |
193 | - if (preg_match("/--\s*@description:\s*(?<name>.*)/", $data["content"], $description)) { |
|
194 | - $data["description"] = $description["name"]; |
|
193 | + if (preg_match("/--\s*@description:\s*(?<name>.*)/", $data[ "content" ], $description)) { |
|
194 | + $data[ "description" ] = $description[ "name" ]; |
|
195 | 195 | } |
196 | 196 | |
197 | - $data["exists"] = true; |
|
198 | - $data["checksum"] = sha1($data["content"]); |
|
197 | + $data[ "exists" ] = true; |
|
198 | + $data[ "checksum" ] = sha1($data[ "content" ]); |
|
199 | 199 | |
200 | 200 | return $data; |
201 | 201 | } |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | $fileInfo = $this->getFileContent($this->getBaseSql()); |
228 | 228 | |
229 | 229 | if ($this->callableProgress) { |
230 | - call_user_func_array($this->callableProgress, ['reset', 0, $fileInfo]); |
|
230 | + call_user_func_array($this->callableProgress, [ 'reset', 0, $fileInfo ]); |
|
231 | 231 | } |
232 | 232 | $this->getDbCommand()->dropDatabase(); |
233 | 233 | $this->getDbCommand()->createDatabase(); |
234 | 234 | $this->getDbCommand()->createVersion(); |
235 | 235 | |
236 | - if ($fileInfo["exists"]) { |
|
236 | + if ($fileInfo[ "exists" ]) { |
|
237 | 237 | $this->getDbCommand()->executeSql(file_get_contents($this->getBaseSql())); |
238 | 238 | } |
239 | 239 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | protected function migrate($upVersion, $increment, $force) |
303 | 303 | { |
304 | 304 | $versionInfo = $this->getCurrentVersion(); |
305 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
305 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
306 | 306 | |
307 | - if (strpos($versionInfo['status'], Migration::VERSION_STATUS_PARTIAL) !== false && !$force) { |
|
307 | + if (strpos($versionInfo[ 'status' ], Migration::VERSION_STATUS_PARTIAL) !== false && !$force) { |
|
308 | 308 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
309 | 309 | } |
310 | 310 | |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | ) { |
313 | 313 | $fileInfo = $this->getFileContent($this->getMigrationSql($currentVersion, $increment)); |
314 | 314 | |
315 | - if (!$fileInfo["exists"]) { |
|
315 | + if (!$fileInfo[ "exists" ]) { |
|
316 | 316 | break; |
317 | 317 | } |
318 | 318 | |
319 | 319 | if ($this->callableProgress) { |
320 | - call_user_func_array($this->callableProgress, ['migrate', $currentVersion, $fileInfo]); |
|
320 | + call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion, $fileInfo ]); |
|
321 | 321 | } |
322 | 322 | |
323 | - $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_PARTIAL . ' ' . ($increment>0 ? 'up' : 'down')); |
|
324 | - $this->getDbCommand()->executeSql($fileInfo["content"]); |
|
323 | + $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_PARTIAL . ' ' . ($increment > 0 ? 'up' : 'down')); |
|
324 | + $this->getDbCommand()->executeSql($fileInfo[ "content" ]); |
|
325 | 325 | $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_COMPLETE); |
326 | 326 | $currentVersion = $currentVersion + $increment; |
327 | 327 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | public function update($upVersion = null, $force = false) |
358 | 358 | { |
359 | 359 | $versionInfo = $this->getCurrentVersion(); |
360 | - $version = intval($versionInfo['version']); |
|
360 | + $version = intval($versionInfo[ 'version' ]); |
|
361 | 361 | $increment = 1; |
362 | 362 | if ($upVersion !== null && $upVersion < $version) { |
363 | 363 | $increment = -1; |