@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @var array |
46 | 46 | */ |
47 | - protected static $databases = []; |
|
47 | + protected static $databases = [ ]; |
|
48 | 48 | /** |
49 | 49 | * @var string |
50 | 50 | */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $protocolList = $class::schema(); |
84 | 84 | foreach ((array)$protocolList as $item) { |
85 | - self::$databases[$item] = $class; |
|
85 | + self::$databases[ $item ] = $class; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function getDatabaseClassName() |
121 | 121 | { |
122 | - if (isset(self::$databases[$this->uri->getScheme()])) { |
|
123 | - return self::$databases[$this->uri->getScheme()]; |
|
122 | + if (isset(self::$databases[ $this->uri->getScheme() ])) { |
|
123 | + return self::$databases[ $this->uri->getScheme() ]; |
|
124 | 124 | } |
125 | 125 | throw new DatabaseDoesNotRegistered( |
126 | 126 | 'Scheme "' . $this->uri->getScheme() . '" does not found. Did you registered it?' |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | . "/" . ($increment < 0 ? "down" : "up") |
161 | 161 | . "/*.sql"; |
162 | 162 | |
163 | - $result = array_filter(glob($filePattern), function ($file) use ($version) { |
|
163 | + $result = array_filter(glob($filePattern), function($file) use ($version) { |
|
164 | 164 | return preg_match("/^0*$version(-dev)?\.sql$/", basename($file)); |
165 | 165 | }); |
166 | 166 | |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | return $data; |
196 | 196 | } |
197 | 197 | |
198 | - $data["content"] = file_get_contents($file); |
|
198 | + $data[ "content" ] = file_get_contents($file); |
|
199 | 199 | |
200 | - if (preg_match("/--\s*@description:\s*(?<name>.*)/", $data["content"], $description)) { |
|
201 | - $data["description"] = $description["name"]; |
|
200 | + if (preg_match("/--\s*@description:\s*(?<name>.*)/", $data[ "content" ], $description)) { |
|
201 | + $data[ "description" ] = $description[ "name" ]; |
|
202 | 202 | } |
203 | 203 | |
204 | - $data["exists"] = true; |
|
205 | - $data["checksum"] = sha1($data["content"]); |
|
204 | + $data[ "exists" ] = true; |
|
205 | + $data[ "checksum" ] = sha1($data[ "content" ]); |
|
206 | 206 | |
207 | 207 | return $data; |
208 | 208 | } |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | $fileInfo = $this->getFileContent($this->getBaseSql()); |
235 | 235 | |
236 | 236 | if ($this->callableProgress) { |
237 | - call_user_func_array($this->callableProgress, ['reset', 0, $fileInfo]); |
|
237 | + call_user_func_array($this->callableProgress, [ 'reset', 0, $fileInfo ]); |
|
238 | 238 | } |
239 | 239 | $this->getDbCommand()->dropDatabase(); |
240 | 240 | $this->getDbCommand()->createDatabase(); |
241 | 241 | $this->getDbCommand()->createVersion(); |
242 | 242 | |
243 | - if ($fileInfo["exists"]) { |
|
244 | - $this->getDbCommand()->executeSql($fileInfo["content"]); |
|
243 | + if ($fileInfo[ "exists" ]) { |
|
244 | + $this->getDbCommand()->executeSql($fileInfo[ "content" ]); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $this->getDbCommand()->setVersion(0, Migration::VERSION_STATUS_COMPLETE); |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | protected function migrate($upVersion, $increment, $force) |
310 | 310 | { |
311 | 311 | $versionInfo = $this->getCurrentVersion(); |
312 | - $currentVersion = intval($versionInfo['version']) + $increment; |
|
312 | + $currentVersion = intval($versionInfo[ 'version' ]) + $increment; |
|
313 | 313 | |
314 | - if (strpos($versionInfo['status'], Migration::VERSION_STATUS_PARTIAL) !== false && !$force) { |
|
314 | + if (strpos($versionInfo[ 'status' ], Migration::VERSION_STATUS_PARTIAL) !== false && !$force) { |
|
315 | 315 | throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.'); |
316 | 316 | } |
317 | 317 | |
@@ -319,16 +319,16 @@ discard block |
||
319 | 319 | ) { |
320 | 320 | $fileInfo = $this->getFileContent($this->getMigrationSql($currentVersion, $increment)); |
321 | 321 | |
322 | - if (!$fileInfo["exists"]) { |
|
322 | + if (!$fileInfo[ "exists" ]) { |
|
323 | 323 | break; |
324 | 324 | } |
325 | 325 | |
326 | 326 | if ($this->callableProgress) { |
327 | - call_user_func_array($this->callableProgress, ['migrate', $currentVersion, $fileInfo]); |
|
327 | + call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion, $fileInfo ]); |
|
328 | 328 | } |
329 | 329 | |
330 | - $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_PARTIAL . ' ' . ($increment>0 ? 'up' : 'down')); |
|
331 | - $this->getDbCommand()->executeSql($fileInfo["content"]); |
|
330 | + $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_PARTIAL . ' ' . ($increment > 0 ? 'up' : 'down')); |
|
331 | + $this->getDbCommand()->executeSql($fileInfo[ "content" ]); |
|
332 | 332 | $this->getDbCommand()->setVersion($currentVersion, Migration::VERSION_STATUS_COMPLETE); |
333 | 333 | $currentVersion = $currentVersion + $increment; |
334 | 334 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | public function update($upVersion = null, $force = false) |
365 | 365 | { |
366 | 366 | $versionInfo = $this->getCurrentVersion(); |
367 | - $version = intval($versionInfo['version']); |
|
367 | + $version = intval($versionInfo[ 'version' ]); |
|
368 | 368 | $increment = 1; |
369 | 369 | if ($upVersion !== null && $upVersion < $version) { |
370 | 370 | $increment = -1; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public static function schema() |
12 | 12 | { |
13 | - return ['dblib', 'sqlsrv']; |
|
13 | + return [ 'dblib', 'sqlsrv' ]; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public static function prepareEnvironment(UriInterface $uri) |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public static function schema() |
12 | 12 | { |
13 | - return ['mysql', 'mariadb']; |
|
13 | + return [ 'mysql', 'mariadb' ]; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public static function prepareEnvironment(UriInterface $uri) |