@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected function dumpSync(bool $isPreview, string $connector = 'mysql'): string |
| 31 | 31 | { |
| 32 | - $path = storage_path('dumps/' . date('YmdHis') . '_sync' . ($isPreview ? '_preview' : '') . '.sql'); |
|
| 33 | - $this->warn('Dump "' . basename($path) . '"...'); |
|
| 32 | + $path = storage_path('dumps/'.date('YmdHis').'_sync'.($isPreview ? '_preview' : '').'.sql'); |
|
| 33 | + $this->warn('Dump "'.basename($path).'"...'); |
|
| 34 | 34 | |
| 35 | 35 | $dirName = dirname($path); |
| 36 | - if (! is_dir($dirName)) { |
|
| 36 | + if (!is_dir($dirName)) { |
|
| 37 | 37 | mkdir($dirName, 0777, true); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | $exec = 'export MYSQL_PWD=\'%s\'; mysqldump --add-drop-table --default-character-set=%s %s -u %s -h %s --port %s > %s'; |
| 55 | 55 | |
| 56 | 56 | $command = sprintf($exec, |
| 57 | - addcslashes(config('database.connections.' . $connector . '.password'), "'"), |
|
| 58 | - config('database.connections.' . $connector . '.charset'), |
|
| 59 | - config('database.connections.' . $connector . '.database'), |
|
| 60 | - config('database.connections.' . $connector . '.username'), |
|
| 61 | - config('database.connections.' . $connector . '.host'), |
|
| 62 | - config('database.connections.' . $connector . '.port'), |
|
| 57 | + addcslashes(config('database.connections.'.$connector.'.password'), "'"), |
|
| 58 | + config('database.connections.'.$connector.'.charset'), |
|
| 59 | + config('database.connections.'.$connector.'.database'), |
|
| 60 | + config('database.connections.'.$connector.'.username'), |
|
| 61 | + config('database.connections.'.$connector.'.host'), |
|
| 62 | + config('database.connections.'.$connector.'.port'), |
|
| 63 | 63 | $path |
| 64 | 64 | ); |
| 65 | 65 | exec($command); |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | protected function getConnector(bool $isPreview, string $connector = 'mysql'): string |
| 69 | 69 | { |
| 70 | - $compiledConnector = $connector . ($isPreview ? '_preview' : ''); |
|
| 70 | + $compiledConnector = $connector.($isPreview ? '_preview' : ''); |
|
| 71 | 71 | |
| 72 | - if (empty(config('database.connections.' . $compiledConnector . '.username'))) { |
|
| 72 | + if (empty(config('database.connections.'.$compiledConnector.'.username'))) { |
|
| 73 | 73 | $compiledConnector = $connector; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'database.default' => $compiledConnector, |
| 93 | 93 | ]); |
| 94 | 94 | |
| 95 | - $this->warn('Put into "' . $compiledConnector . '" database...'); |
|
| 95 | + $this->warn('Put into "'.$compiledConnector.'" database...'); |
|
| 96 | 96 | $this->putSql($path, $compiledConnector); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | $exec = 'export MYSQL_PWD=\'%s\'; mysql -u %s -h %s --port %s %s < %s'; |
| 109 | 109 | |
| 110 | 110 | $command = sprintf($exec, |
| 111 | - addcslashes(config('database.connections.' . $connector . '.password'), "'"), |
|
| 112 | - config('database.connections.' . $connector . '.username'), |
|
| 113 | - config('database.connections.' . $connector . '.host'), |
|
| 114 | - config('database.connections.' . $connector . '.port'), |
|
| 115 | - config('database.connections.' . $connector . '.database'), |
|
| 111 | + addcslashes(config('database.connections.'.$connector.'.password'), "'"), |
|
| 112 | + config('database.connections.'.$connector.'.username'), |
|
| 113 | + config('database.connections.'.$connector.'.host'), |
|
| 114 | + config('database.connections.'.$connector.'.port'), |
|
| 115 | + config('database.connections.'.$connector.'.database'), |
|
| 116 | 116 | $path |
| 117 | 117 | ); |
| 118 | 118 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $bool = $this->option('no-switch'); |
| 73 | 73 | |
| 74 | - return ! empty($bool) ? false : true; |
|
| 74 | + return !empty($bool) ? false : true; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $bool = $this->option('no-truncate'); |
| 85 | 85 | |
| 86 | - return ! empty($bool) ? true : false; |
|
| 86 | + return !empty($bool) ? true : false; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $bool = $this->option('preview'); |
| 97 | 97 | |
| 98 | - return ! empty($bool) ? true : false; |
|
| 98 | + return !empty($bool) ? true : false; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $bool = $this->option('multi'); |
| 109 | 109 | |
| 110 | - return ! empty($bool) ? true : false; |
|
| 110 | + return !empty($bool) ? true : false; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $this->switchToSyncDb(); |
| 128 | 128 | |
| 129 | - if (! $this->withoutTruncate()) { |
|
| 129 | + if (!$this->withoutTruncate()) { |
|
| 130 | 130 | $this->line('Truncate Contentful related tables'); |
| 131 | 131 | $this->assets->truncateRelatedTables(); |
| 132 | 132 | $this->entries->truncateRelatedTables(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $bar = $this->createProgressBar($paginator->total()); |
| 168 | 168 | while ($paginator->isNotEmpty()) { |
| 169 | 169 | foreach ($paginator->items() as $item) { |
| 170 | - $bar->setMessage('Map entry ID: ' . $item->contentful_id); |
|
| 170 | + $bar->setMessage('Map entry ID: '.$item->contentful_id); |
|
| 171 | 171 | $this->mapItemToContentfulModel($item, $locales); |
| 172 | 172 | $bar->advance(); |
| 173 | 173 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->updateFromOtherThread($bar); |
| 192 | 192 | $items = collect(); |
| 193 | 193 | |
| 194 | - DB::transaction(function () use ($release, & $items) { |
|
| 194 | + DB::transaction(function() use ($release, & $items) { |
|
| 195 | 195 | $items = DB::table('sync_entries') |
| 196 | 196 | ->whereNull('release_id') |
| 197 | 197 | ->take(static::PER_BATCH) |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | $items = collect(); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - $items->each(function ($item, $key) use ($locales, $bar) { |
|
| 211 | - $bar->setMessage('Map entry ID: ' . $item->contentful_id); |
|
| 210 | + $items->each(function($item, $key) use ($locales, $bar) { |
|
| 211 | + $bar->setMessage('Map entry ID: '.$item->contentful_id); |
|
| 212 | 212 | $this->mapItemToContentfulModel($item, $locales); |
| 213 | 213 | $bar->advance(); |
| 214 | 214 | }); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | $bar = $this->output->createProgressBar($total); |
| 251 | 251 | |
| 252 | - $bar->setFormat("%message%" . PHP_EOL . " %current%/%max% [%bar%] %percent:3s%%"); |
|
| 252 | + $bar->setFormat("%message%".PHP_EOL." %current%/%max% [%bar%] %percent:3s%%"); |
|
| 253 | 253 | |
| 254 | 254 | return $bar; |
| 255 | 255 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $bool = $this->option('live'); |
| 29 | 29 | |
| 30 | - return ! empty($bool) ? true : false; |
|
| 30 | + return !empty($bool) ? true : false; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $bool = $this->option('preview'); |
| 41 | 41 | |
| 42 | - return ! empty($bool) ? true : false; |
|
| 42 | + return !empty($bool) ? true : false; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $contentTypes = $this->api->contentTypes(); |
| 30 | 30 | |
| 31 | - if (! empty($contentTypes['items'])) { |
|
| 31 | + if (!empty($contentTypes['items'])) { |
|
| 32 | 32 | array_unshift($contentTypes['items'], $this->assetContentType()); |
| 33 | 33 | foreach ($contentTypes['items'] as $contentType) { |
| 34 | 34 | if ($contentType['sys']['id'] !== 'asset') { |
| 35 | - $this->info('Content-Type: ' . Str::upper($contentType['name'])); |
|
| 35 | + $this->info('Content-Type: '.Str::upper($contentType['name'])); |
|
| 36 | 36 | $file = $this->createMigration($contentType); |
| 37 | - $this->line('Migration "' . $file . '" created'); |
|
| 37 | + $this->line('Migration "'.$file.'" created'); |
|
| 38 | 38 | sleep(1); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $table = $this->tableName($contentType['sys']['id']); |
| 54 | 54 | |
| 55 | - $stubPath = __DIR__ . '/stubs/migration.stub'; |
|
| 56 | - $destPath = database_path('migrations/' . Carbon::now()->format('Y_m_d_His') . '_create_' . $table . '_table.php'); |
|
| 55 | + $stubPath = __DIR__.'/stubs/migration.stub'; |
|
| 56 | + $destPath = database_path('migrations/'.Carbon::now()->format('Y_m_d_His').'_create_'.$table.'_table.php'); |
|
| 57 | 57 | |
| 58 | 58 | return static::writeStub($stubPath, $destPath, [ |
| 59 | 59 | 'class' => Str::studly($table), |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | public function modelGetter() |
| 11 | 11 | { |
| 12 | - $stubPath = __DIR__ . '/stubs/json.stub'; |
|
| 12 | + $stubPath = __DIR__.'/stubs/json.stub'; |
|
| 13 | 13 | |
| 14 | 14 | return self::getStub($stubPath, [ |
| 15 | 15 | 'field' => $this->id(), |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function modelProperty() |
| 24 | 24 | { |
| 25 | - return ' * @property array $' . $this->snakeId(); |
|
| 25 | + return ' * @property array $'.$this->snakeId(); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | $content = file_get_contents($stubPath); |
| 84 | 84 | |
| 85 | 85 | foreach ($replacements as $key => $value) { |
| 86 | - $content = str_replace('{{' . Str::upper($key) . '}}', $value, $content); |
|
| 86 | + $content = str_replace('{{'.Str::upper($key).'}}', $value, $content); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return $content; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | public function modelGetter() |
| 11 | 11 | { |
| 12 | - $stubPath = __DIR__ . '/stubs/float.stub'; |
|
| 12 | + $stubPath = __DIR__.'/stubs/float.stub'; |
|
| 13 | 13 | |
| 14 | 14 | return self::getStub($stubPath, [ |
| 15 | 15 | 'field' => $this->id(), |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function modelProperty() |
| 24 | 24 | { |
| 25 | - return ' * @property float $' . $this->snakeId(); |
|
| 25 | + return ' * @property float $'.$this->snakeId(); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | public function modelGetter() |
| 11 | 11 | { |
| 12 | - $stubPath = __DIR__ . '/stubs/string.stub'; |
|
| 12 | + $stubPath = __DIR__.'/stubs/string.stub'; |
|
| 13 | 13 | |
| 14 | 14 | return self::getStub($stubPath, [ |
| 15 | 15 | 'field' => $this->id(), |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function modelProperty() |
| 24 | 24 | { |
| 25 | - return ' * @property string $' . $this->snakeId(); |
|
| 25 | + return ' * @property string $'.$this->snakeId(); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | public function modelGetter() |
| 11 | 11 | { |
| 12 | - $stubPath = __DIR__ . '/stubs/location.stub'; |
|
| 12 | + $stubPath = __DIR__.'/stubs/location.stub'; |
|
| 13 | 13 | |
| 14 | 14 | return self::getStub($stubPath, [ |
| 15 | 15 | 'field' => $this->id(), |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function modelProperty() |
| 24 | 24 | { |
| 25 | - return ' * @property \Distilleries\Contentful\Models\Location $' . $this->snakeId(); |
|
| 25 | + return ' * @property \Distilleries\Contentful\Models\Location $'.$this->snakeId(); |
|
| 26 | 26 | } |
| 27 | 27 | } |