@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | return [ |
49 | - 'title' => ! empty($model->title) ? $model->title : null, |
|
50 | - 'description' => ! empty($model->description) ? $model->description : null, |
|
49 | + 'title' => !empty($model->title) ? $model->title : null, |
|
50 | + 'description' => !empty($model->description) ? $model->description : null, |
|
51 | 51 | 'url' => $url, |
52 | 52 | ]; |
53 | 53 | } |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function transformCollection(Collection $collection, array $parameters = []): Collection |
63 | 63 | { |
64 | - $collection->filter(function ($value) { |
|
65 | - return ! empty($value); |
|
64 | + $collection->filter(function($value) { |
|
65 | + return !empty($value); |
|
66 | 66 | }); |
67 | 67 | |
68 | 68 | if ($collection->isEmpty()) { |
69 | 69 | return collect(); |
70 | 70 | } |
71 | 71 | |
72 | - return $collection->transform(function ($model) use ($parameters) { |
|
72 | + return $collection->transform(function($model) use ($parameters) { |
|
73 | 73 | return $this->transform($model, $parameters); |
74 | 74 | }); |
75 | 75 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - throw new Exception('Invalid field signature... ' . PHP_EOL . print_r($localeField, true)); |
|
177 | + throw new Exception('Invalid field signature... '.PHP_EOL.print_r($localeField, true)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | return $entry['sys']['contentType']['sys']['id']; |
217 | 217 | } |
218 | 218 | } catch (Exception $e) { |
219 | - throw new Exception('Unknown content-type from synced entry: ' . $contentfulId); |
|
219 | + throw new Exception('Unknown content-type from synced entry: '.$contentfulId); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if ($relationship->related_contentful_type === 'asset') { |
246 | 246 | $model = new Asset; |
247 | 247 | } else { |
248 | - $modelClass = config('contentful.namespace.model') . '\\' . studly_case($relationship->related_contentful_type); |
|
248 | + $modelClass = config('contentful.namespace.model').'\\'.studly_case($relationship->related_contentful_type); |
|
249 | 249 | $model = new $modelClass; |
250 | 250 | } |
251 | 251 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $model = new Asset; |
295 | 295 | } else { |
296 | 296 | $modelClass = rtrim(config('contentful.namespace.model'), |
297 | - '\\') . '\\' . studly_case($relationship->source_contentful_type); |
|
297 | + '\\').'\\'.studly_case($relationship->source_contentful_type); |
|
298 | 298 | $model = new $modelClass; |
299 | 299 | } |
300 | 300 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $country = !empty($country) ? $country : Locale::getAppOrDefaultCountry(); |
24 | 24 | |
25 | 25 | return $query |
26 | - ->whereRaw('LOWER(' . $this->getTable() . '.country) LIKE LOWER("' . $country . '")') |
|
27 | - ->whereRaw('LOWER(' . $this->getTable() . '.locale) LIKE LOWER("' . $locale . '")'); |
|
26 | + ->whereRaw('LOWER('.$this->getTable().'.country) LIKE LOWER("'.$country.'")') |
|
27 | + ->whereRaw('LOWER('.$this->getTable().'.locale) LIKE LOWER("'.$locale.'")'); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | public function apply(Builder $builder, Model $model) |
19 | 19 | { |
20 | 20 | $builder |
21 | - ->whereNotNull($model->getTable() . '.slug') |
|
22 | - ->where($model->getTable() . '.slug', '!=', ''); |
|
21 | + ->whereNotNull($model->getTable().'.slug') |
|
22 | + ->where($model->getTable().'.slug', '!=', ''); |
|
23 | 23 | |
24 | 24 | $this->extend($builder); |
25 | 25 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function extend(Builder $builder) |
34 | 34 | { |
35 | - $builder->macro('allowNullSlug', function (Builder $builder) { |
|
35 | + $builder->macro('allowNullSlug', function(Builder $builder) { |
|
36 | 36 | return $builder->withoutGlobalScope($this); |
37 | 37 | }); |
38 | 38 | } |
@@ -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 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ->where('is_default', '=', true) |
108 | 108 | ->first(); |
109 | 109 | |
110 | - $default = ! empty($default) ? $default->country : config('contentful.default_country'); |
|
110 | + $default = !empty($default) ? $default->country : config('contentful.default_country'); |
|
111 | 111 | |
112 | 112 | // Cache is cleaned in Console\Commands\SyncLocales (run at least daily) |
113 | 113 | Cache::forever('country_default', $default); |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public static function fallback(string $code): string |
126 | 126 | { |
127 | - $fallback = Cache::get('locale_fallback_' . $code); |
|
127 | + $fallback = Cache::get('locale_fallback_'.$code); |
|
128 | 128 | |
129 | 129 | if ($fallback === null) { |
130 | 130 | $locale = static::select('fallback_code') |
131 | 131 | ->where('code', '=', $code) |
132 | 132 | ->first(); |
133 | 133 | |
134 | - $fallback = (! empty($locale) && ! empty($locale->fallback_code)) ? $locale->fallback_code : ''; |
|
134 | + $fallback = (!empty($locale) && !empty($locale->fallback_code)) ? $locale->fallback_code : ''; |
|
135 | 135 | |
136 | - Cache::put('locale_fallback_' . $code, $fallback, 5); |
|
136 | + Cache::put('locale_fallback_'.$code, $fallback, 5); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $fallback; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public static function canBeSave(string $country, string $locale): bool |
150 | 150 | { |
151 | - return ! in_array($country . '_' . $locale, static::_getLocalesDisabled()); |
|
151 | + return !in_array($country.'_'.$locale, static::_getLocalesDisabled()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function isEnabled(): bool |
172 | 172 | { |
173 | - return ! in_array($this->country . '_' . $this->locale, static::_getLocalesDisabled()); |
|
173 | + return !in_array($this->country.'_'.$this->locale, static::_getLocalesDisabled()); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public static function getAcceptedLanguages(Request $request = null) |
225 | 225 | { |
226 | - $request = ! empty($request) ? $request : request(); |
|
226 | + $request = !empty($request) ? $request : request(); |
|
227 | 227 | |
228 | 228 | $languages = $request->server('HTTP_ACCEPT_LANGUAGE'); |
229 | - if (! empty($languages)) { |
|
229 | + if (!empty($languages)) { |
|
230 | 230 | preg_match_all('/(\W|^)([a-z]{2})([^a-z]|$)/six', $languages, $locales, PREG_PATTERN_ORDER); |
231 | 231 | |
232 | - if (! empty($locales) && ! empty($locales[2])) { |
|
232 | + if (!empty($locales) && !empty($locales[2])) { |
|
233 | 233 | return $locales[2]; |
234 | 234 | } |
235 | 235 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | { |
248 | 248 | $country = static::defaultCountry(); |
249 | 249 | $locales = static::getAcceptedLanguages($request); |
250 | - $locale = ! empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
250 | + $locale = !empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
251 | 251 | |
252 | 252 | $localeModel = (new static) |
253 | 253 | ->where('country', $country) |
@@ -70,8 +70,8 @@ |
||
70 | 70 | */ |
71 | 71 | public function getRelatedEntry() |
72 | 72 | { |
73 | - $localModel = rtrim(config('contentful.namespaces.model'), '\\') . '\\' . ucfirst($this->src_content_type); |
|
74 | - if (! class_exists($localModel)) { |
|
73 | + $localModel = rtrim(config('contentful.namespaces.model'), '\\').'\\'.ucfirst($this->src_content_type); |
|
74 | + if (!class_exists($localModel)) { |
|
75 | 75 | return null; |
76 | 76 | } |
77 | 77 |
@@ -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, |