@@ -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/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 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | // Override fillable |
| 47 | 47 | foreach ($this->defaultFillable() as $defaultFillable) { |
| 48 | - if (! in_array($defaultFillable, $this->fillable)) { |
|
| 48 | + if (!in_array($defaultFillable, $this->fillable)) { |
|
| 49 | 49 | $this->fillable[] = $defaultFillable; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Override casts |
| 54 | 54 | foreach ($this->defaultCasts() as $field => $type) { |
| 55 | - if (! isset($this->casts[$field])) { |
|
| 55 | + if (!isset($this->casts[$field])) { |
|
| 56 | 56 | $this->casts[$field] = $type; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function getAndSetPayloadContentfulAsset(string $payload, $link, $query = null): ?Asset |
| 119 | 119 | { |
| 120 | - if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 120 | + if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 121 | 121 | $this->attributes[$payload] = $this->contentfulAsset($link, $query); |
| 122 | 122 | return $this->attributes[$payload]; |
| 123 | 123 | } else { |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | ->where('locale', '=', $this->locale) |
| 150 | 150 | ->where('country', '=', $this->country); |
| 151 | 151 | |
| 152 | - if (! empty($query)) { |
|
| 152 | + if (!empty($query)) { |
|
| 153 | 153 | $instance = call_user_func($query, $instance); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $asset = $instance->first(); |
| 157 | 157 | |
| 158 | - return ! empty($asset) ? $asset : null; |
|
| 158 | + return !empty($asset) ? $asset : null; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function getAndSetPayloadContentfulEntries(string $payload, array $links, $query = null): Collection |
| 170 | 170 | { |
| 171 | - if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 171 | + if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 172 | 172 | $this->attributes[$payload] = $this->contentfulEntries($links, $query, $payload); |
| 173 | 173 | |
| 174 | 174 | return $this->attributes[$payload]; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | protected function getAndSetPayloadContentfulEntry(string $payload, array $links, $query = null): ?ContentfulModel |
| 193 | 193 | { |
| 194 | - if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 194 | + if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) { |
|
| 195 | 195 | $this->attributes[$payload] = $this->contentfulEntry($links, $query, $payload); |
| 196 | 196 | |
| 197 | 197 | return $this->attributes[$payload]; |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | $entryIds = []; |
| 241 | 241 | foreach ($links as $link) { |
| 242 | 242 | $entryId = $this->contentfulLinkId($link); |
| 243 | - if (! empty($entryId)) { |
|
| 243 | + if (!empty($entryId)) { |
|
| 244 | 244 | $entryIds[] = $entryId; |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if (! empty($entryIds)) { |
|
| 248 | + if (!empty($entryIds)) { |
|
| 249 | 249 | $relationships = EntryRelationship::select('related_contentful_id', 'related_contentful_type', 'order') |
| 250 | 250 | ->distinct() |
| 251 | 251 | ->locale($this->locale, $this->country) |
@@ -262,20 +262,20 @@ discard block |
||
| 262 | 262 | $model = NamespaceResolver::model($relationship->related_contentful_type); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if (! empty($model)) { |
|
| 265 | + if (!empty($model)) { |
|
| 266 | 266 | $instance = $model->query() |
| 267 | 267 | ->where('country', '=', $this->country) |
| 268 | 268 | ->where('locale', '=', $this->locale) |
| 269 | 269 | ->where('contentful_id', '=', $relationship->related_contentful_id); |
| 270 | 270 | |
| 271 | - if (! empty($query)) { |
|
| 271 | + if (!empty($query)) { |
|
| 272 | 272 | $instance = call_user_func($query, $instance); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $instance = $instance->first(); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if (! empty($instance)) { |
|
| 278 | + if (!empty($instance)) { |
|
| 279 | 279 | $entries[] = $instance; |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | ->locale($this->locale, $this->country) |
| 300 | 300 | ->where('related_contentful_id', '=', $contentfulId); |
| 301 | 301 | |
| 302 | - if (! empty($contentfulType)) { |
|
| 302 | + if (!empty($contentfulType)) { |
|
| 303 | 303 | $query = $query->where('source_contentful_type', '=', $contentfulType); |
| 304 | 304 | } |
| 305 | 305 | |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | $model = NamespaceResolver::model($relationship->related_contentful_type); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $instance = ! empty($model) ? $model->query() |
|
| 314 | + $instance = !empty($model) ? $model->query() |
|
| 315 | 315 | ->locale($this->locale, $this->country) |
| 316 | 316 | ->where('contentful_id', '=', $relationship->source_contentful_id) |
| 317 | 317 | ->first() : null; |
| 318 | 318 | |
| 319 | - if (! empty($instance)) { |
|
| 319 | + if (!empty($instance)) { |
|
| 320 | 320 | $entries[] = $instance; |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $array = parent::toArray(); |
| 376 | 376 | |
| 377 | 377 | foreach ($this->getMutatedAttributes() as $key) { |
| 378 | - if (! array_key_exists($key, $array)) { |
|
| 378 | + if (!array_key_exists($key, $array)) { |
|
| 379 | 379 | $array[$key] = $this->{$key}; |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | public function boot() |
| 40 | 40 | { |
| 41 | 41 | $this->publishes([ |
| 42 | - __DIR__ . '/../../config/config.php' => base_path('config/' . $this->package . '.php'), |
|
| 42 | + __DIR__.'/../../config/config.php' => base_path('config/'.$this->package.'.php'), |
|
| 43 | 43 | ], 'config'); |
| 44 | 44 | |
| 45 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations/'); |
|
| 45 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations/'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function register() |
| 54 | 54 | { |
| 55 | - $this->mergeConfigFrom(__DIR__ . '/../../config/config.php', $this->package); |
|
| 55 | + $this->mergeConfigFrom(__DIR__.'/../../config/config.php', $this->package); |
|
| 56 | 56 | |
| 57 | 57 | $this->app->bind(Api\DeliveryApi::class, Api\Delivery\Cached::class); |
| 58 | 58 | $this->app->bind(Api\ManagementApi::class, Api\Management\Api::class); |
@@ -73,31 +73,31 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function registerCommands() |
| 75 | 75 | { |
| 76 | - $this->app->singleton('command.contentful.model', function () { |
|
| 76 | + $this->app->singleton('command.contentful.model', function() { |
|
| 77 | 77 | return new Commands\Generators\Models(app(Api\ManagementApi::class)); |
| 78 | 78 | }); |
| 79 | - $this->app->singleton('command.contentful.migration', function () { |
|
| 79 | + $this->app->singleton('command.contentful.migration', function() { |
|
| 80 | 80 | return new Commands\Generators\Migrations(app(Api\ManagementApi::class)); |
| 81 | 81 | }); |
| 82 | - $this->app->singleton('command.contentful.sync', function () { |
|
| 82 | + $this->app->singleton('command.contentful.sync', function() { |
|
| 83 | 83 | return new Commands\Sync\Sync; |
| 84 | 84 | }); |
| 85 | - $this->app->singleton('command.contentful.sync-switch', function () { |
|
| 85 | + $this->app->singleton('command.contentful.sync-switch', function() { |
|
| 86 | 86 | return new Commands\Sync\SyncSwitch; |
| 87 | 87 | }); |
| 88 | - $this->app->singleton('command.contentful.sync-data', function () { |
|
| 88 | + $this->app->singleton('command.contentful.sync-data', function() { |
|
| 89 | 89 | return new Commands\Sync\SyncData(app(Api\SyncApi::class)); |
| 90 | 90 | }); |
| 91 | - $this->app->singleton('command.contentful.sync-flatten', function () { |
|
| 91 | + $this->app->singleton('command.contentful.sync-flatten', function() { |
|
| 92 | 92 | return new Commands\Sync\SyncFlatten; |
| 93 | 93 | }); |
| 94 | - $this->app->singleton('command.contentful.sync-locales', function () { |
|
| 94 | + $this->app->singleton('command.contentful.sync-locales', function() { |
|
| 95 | 95 | return new Commands\Sync\SyncLocales(app(Api\ManagementApi::class)); |
| 96 | 96 | }); |
| 97 | - $this->app->singleton('command.contentful.import-clean', function () { |
|
| 97 | + $this->app->singleton('command.contentful.import-clean', function() { |
|
| 98 | 98 | return new Commands\Import\ImportClean(app(Api\ManagementApi::class)); |
| 99 | 99 | }); |
| 100 | - $this->app->singleton('command.contentful.import-publish', function () { |
|
| 100 | + $this->app->singleton('command.contentful.import-publish', function() { |
|
| 101 | 101 | return new Commands\Import\ImportPublish(app(Api\ManagementApi::class)); |
| 102 | 102 | }); |
| 103 | 103 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function registerContentfulRelated() |
| 121 | 121 | { |
| 122 | - $this->app->singleton('contentful.rich-text.parser', function () { |
|
| 122 | + $this->app->singleton('contentful.rich-text.parser', function() { |
|
| 123 | 123 | $spaceId = config('contentful.space_id'); |
| 124 | 124 | $environment = config('contentful.environment'); |
| 125 | 125 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function toJson($data, $default = null): string |
| 54 | 54 | { |
| 55 | - return ! empty($data) ? json_encode($data): $default; |
|
| 55 | + return !empty($data) ? json_encode($data) : $default; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $html = ''; |
| 91 | 91 | |
| 92 | - if (! empty($object)) { |
|
| 92 | + if (!empty($object)) { |
|
| 93 | 93 | try { |
| 94 | 94 | $node = app('contentful.rich-text.parser')->parse($object); |
| 95 | 95 | $html = (new Renderer)->render($node); |
@@ -198,6 +198,6 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public static function location(array $entry, ?Location $default = null): ?Location |
| 200 | 200 | { |
| 201 | - return ! empty($entry)? new Location($entry) : $default; |
|
| 201 | + return !empty($entry) ? new Location($entry) : $default; |
|
| 202 | 202 | } |
| 203 | 203 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | 'fm' => config('contentful.image.use_webp') ? $format : null, |
| 36 | 36 | 'fl' => static::detectProgressive($format, $useProgressive) ? 'progressive' : null, |
| 37 | 37 | 'fit' => static::detectFit($fit), |
| 38 | - ])->filter(function ($value) { |
|
| 38 | + ])->filter(function($value) { |
|
| 39 | 39 | return !empty($value); |
| 40 | - })->each(function ($value, $key) use (& $imageUrl) { |
|
| 41 | - $imageUrl .= $key . '=' . $value . '&'; |
|
| 40 | + })->each(function($value, $key) use (& $imageUrl) { |
|
| 41 | + $imageUrl .= $key.'='.$value.'&'; |
|
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | 44 | return static::replaceHosts($url, $imageUrl); |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $searchHosts = config('contentful.image.search_hosts'); |
| 62 | 62 | $replaceHost = config('contentful.image.replace_host'); |
| 63 | - if (! empty($searchHosts) && ! empty($replaceHost)) { |
|
| 63 | + if (!empty($searchHosts) && !empty($replaceHost)) { |
|
| 64 | 64 | $url = str_replace(explode(',', $searchHosts), $replaceHost, $url); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return ! empty($url) ? $url . '?' . trim($imageUrl, '&') : ''; |
|
| 67 | + return !empty($url) ? $url.'?'.trim($imageUrl, '&') : ''; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return 'webp'; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return ! empty($format) ? $format : null; |
|
| 83 | + return !empty($format) ? $format : null; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if ($useProgressive === null) { |
| 117 | - $useProgressive = ! empty(config('contentful.image.use_progressive')); |
|
| 117 | + $useProgressive = !empty(config('contentful.image.use_progressive')); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return $useProgressive; |