@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | public function apply(Builder $builder, Model $model) |
20 | 20 | { |
21 | 21 | $builder |
22 | - ->where(function ($query) use ($model) { |
|
22 | + ->where(function($query) use ($model) { |
|
23 | 23 | $query |
24 | - ->whereNull($model->getTable() . '.validated_at') |
|
25 | - ->orWhere($model->getTable() . '.validated_at','>=',Carbon::now()->format('Y-m-d H:i:s')); |
|
24 | + ->whereNull($model->getTable().'.validated_at') |
|
25 | + ->orWhere($model->getTable().'.validated_at', '>=', Carbon::now()->format('Y-m-d H:i:s')); |
|
26 | 26 | }); |
27 | 27 | |
28 | 28 | $this->extend($builder); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function extend(Builder $builder) |
38 | 38 | { |
39 | - $builder->macro('withoutValidated', function (Builder $builder) { |
|
39 | + $builder->macro('withoutValidated', function(Builder $builder) { |
|
40 | 40 | return $builder->withoutGlobalScope($this); |
41 | 41 | }); |
42 | 42 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('use_contentful_preview')) { |
|
3 | +if (!function_exists('use_contentful_preview')) { |
|
4 | 4 | /** |
5 | 5 | * Use Contentful preview switch setup. |
6 | 6 | * |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | function use_contentful_preview(bool $state = true) |
11 | 11 | { |
12 | - if (! empty($state)) { |
|
12 | + if (!empty($state)) { |
|
13 | 13 | config([ |
14 | 14 | 'database.default' => 'mysql_preview', |
15 | 15 | 'contentful.use_preview' => 1, |
@@ -77,7 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | $indexed = []; |
79 | 79 | |
80 | - $locale = ! empty($locale) ? $locale : Locale::default(); |
|
80 | + $locale = !empty($locale) ? $locale : Locale::default(); |
|
81 | 81 | foreach ($data as $field => $value) { |
82 | 82 | $indexed[$field][$locale] = $value; |
83 | 83 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function resetLocales(array $locales) |
68 | 68 | { |
69 | - if (! empty($locales)) { |
|
69 | + if (!empty($locales)) { |
|
70 | 70 | Cache::forget('locale_default'); |
71 | 71 | Locale::query()->truncate(); |
72 | 72 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | 'country' => Locale::getCountry($locale['code']), |
91 | 91 | 'locale' => Locale::getLocale($locale['code']), |
92 | 92 | 'fallback_code' => $locale['fallbackCode'], |
93 | - 'is_default' => ! empty($locale['default']), |
|
94 | - 'is_editable' => ! empty($locale['contentManagementApi']), |
|
95 | - 'is_publishable' => ! empty($locale['contentDeliveryApi']), |
|
93 | + 'is_default' => !empty($locale['default']), |
|
94 | + 'is_editable' => !empty($locale['contentManagementApi']), |
|
95 | + 'is_publishable' => !empty($locale['contentDeliveryApi']), |
|
96 | 96 | ]); |
97 | 97 | } |
98 | 98 | } |
@@ -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 | } |