@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | foreach ($migrations as $migration) { |
| 101 | 101 | if (!$this->migrateUp($migration)) { |
| 102 | - throw new \Exception('Migration failed : ' . $migration); |
|
| 102 | + throw new \Exception('Migration failed : '.$migration); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param array $applied the set of already applied migrations |
| 135 | 135 | * @return array the set of new migrations to be run |
| 136 | 136 | */ |
| 137 | - private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias=null) |
|
| 137 | + private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias = null) |
|
| 138 | 138 | { |
| 139 | 139 | if ($migrationAlias === null) |
| 140 | 140 | $migrationAlias = $pathAlias; |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | if (file_exists($migrationPath)) { |
| 144 | 144 | $handle = opendir($migrationPath); |
| 145 | 145 | while (($file = readdir($handle)) !== false) { |
| 146 | - if ($file === '.' || $file === '..' || is_dir($file) || pathinfo($file, PATHINFO_EXTENSION)!='php') { |
|
| 146 | + if ($file === '.' || $file === '..' || is_dir($file) || pathinfo($file, PATHINFO_EXTENSION) != 'php') { |
|
| 147 | 147 | continue; |
| 148 | 148 | } |
| 149 | - $path = $migrationPath . DIRECTORY_SEPARATOR . $file; |
|
| 150 | - $migrationName = $migrationAlias . '/' . str_replace('.php', '', $file); |
|
| 149 | + $path = $migrationPath.DIRECTORY_SEPARATOR.$file; |
|
| 150 | + $migrationName = $migrationAlias.'/'.str_replace('.php', '', $file); |
|
| 151 | 151 | if (is_file($path) && !isset($applied[$migrationName])) { |
| 152 | 152 | $migrations[] = $migrationName; |
| 153 | 153 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | // try migrate up |
| 273 | 273 | $migrations = $this->getNewMigrations(); |
| 274 | 274 | foreach ($migrations as $i => $migration) { |
| 275 | - if (strpos($migration, $version . '_') === 0) { |
|
| 275 | + if (strpos($migration, $version.'_') === 0) { |
|
| 276 | 276 | $this->actionUp($i + 1); |
| 277 | 277 | |
| 278 | 278 | return self::EXIT_CODE_NORMAL; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | // try migrate down |
| 283 | 283 | $migrations = array_keys($this->getMigrationHistory(null)); |
| 284 | 284 | foreach ($migrations as $i => $migration) { |
| 285 | - if (strpos($migration, $version . '_') === 0) { |
|
| 285 | + if (strpos($migration, $version.'_') === 0) { |
|
| 286 | 286 | if ($i === 0) { |
| 287 | 287 | $this->stdout("Already at '$originalVersion'. Nothing needs to be done.\n", Console::FG_YELLOW); |
| 288 | 288 | } else { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | /** |
| 339 | 339 | * @inheritdoc |
| 340 | 340 | */ |
| 341 | - public function stdout($message, $color='') |
|
| 341 | + public function stdout($message, $color = '') |
|
| 342 | 342 | { |
| 343 | 343 | echo $message; |
| 344 | 344 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @param string $type - can be one of 'info' | 'error' | 'danger' | 'warning' | 'success' |
| 382 | 382 | * @return string / stream |
| 383 | 383 | */ |
| 384 | - public function log($message, $type='info') |
|
| 384 | + public function log($message, $type = 'info') |
|
| 385 | 385 | { |
| 386 | 386 | $colors = [ |
| 387 | 387 | 'info' => Console::FG_BLUE, 'warning' => Console::FG_YELLOW, |
@@ -431,10 +431,10 @@ discard block |
||
| 431 | 431 | foreach ($migrations as $migration) { |
| 432 | 432 | // remove any paths to get the migration itself |
| 433 | 433 | $migrationPart = $migration; |
| 434 | - if (strpos($migration,'/')!==false) |
|
| 435 | - $migrationPart = substr($migration, strrpos($migration,'/')+1); |
|
| 434 | + if (strpos($migration, '/') !== false) |
|
| 435 | + $migrationPart = substr($migration, strrpos($migration, '/') + 1); |
|
| 436 | 436 | |
| 437 | - $parts = explode('_', substr($migrationPart,1)); // remove initial m |
|
| 437 | + $parts = explode('_', substr($migrationPart, 1)); // remove initial m |
|
| 438 | 438 | |
| 439 | 439 | // check it was a migration and has enough parts |
| 440 | 440 | if (count($parts) == 1) { |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | if (!is_numeric($time) || strlen($time) != 6) |
| 453 | 453 | $time = '000000'; |
| 454 | 454 | // some datetimes are YYYYMMDD and others YYMMDD. Canonicalise these |
| 455 | - if (strlen($date)==6) |
|
| 455 | + if (strlen($date) == 6) |
|
| 456 | 456 | $date = "20$date"; |
| 457 | 457 | // turn this into 'YYYY-MM-DD HH:MM:SS' and then into a timestamp |
| 458 | - $dateTime = substr($date,0,4)."-".substr($date,4,2)."-".substr($date,6,2)." ".substr($time,0,2).":".substr($time,2,2).":".substr($time,4,2); |
|
| 458 | + $dateTime = substr($date, 0, 4)."-".substr($date, 4, 2)."-".substr($date, 6, 2)." ".substr($time, 0, 2).":".substr($time, 2, 2).":".substr($time, 4, 2); |
|
| 459 | 459 | $timestamp = strtotime($dateTime); |
| 460 | 460 | if ($timestamp == false) |
| 461 | 461 | throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix."); |