@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if (is_array($value)) { |
134 | 134 | if ($this->isLink($value)) { |
135 | 135 | try { |
136 | - $relationships[] = $this->relationshipSignature($value,$field); |
|
136 | + $relationships[] = $this->relationshipSignature($value, $field); |
|
137 | 137 | } catch (Exception $e) { |
138 | 138 | // |
139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | foreach ($value as $entry) { |
142 | 142 | if ($this->isLink($entry)) { |
143 | 143 | try { |
144 | - $relationships[] = $this->relationshipSignature($entry,$field); |
|
144 | + $relationships[] = $this->relationshipSignature($entry, $field); |
|
145 | 145 | } catch (Exception $e) { |
146 | 146 | // |
147 | 147 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @return array|null |
162 | 162 | * @throws \Exception |
163 | 163 | */ |
164 | - private function relationshipSignature(array $localeField,string $field=''): ?array |
|
164 | + private function relationshipSignature(array $localeField, string $field = ''): ?array |
|
165 | 165 | { |
166 | 166 | if ($localeField['sys']['linkType'] === 'Asset') { |
167 | 167 | return [ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - throw new Exception('Invalid field signature... ' . PHP_EOL . print_r($localeField, true)); |
|
182 | + throw new Exception('Invalid field signature... '.PHP_EOL.print_r($localeField, true)); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | return $entry['sys']['contentType']['sys']['id']; |
222 | 222 | } |
223 | 223 | } catch (Exception $e) { |
224 | - throw new Exception('Unknown content-type from synced entry: ' . $contentfulId); |
|
224 | + throw new Exception('Unknown content-type from synced entry: '.$contentfulId); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -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 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | protected static function _getLocalesDisabled(): array |
160 | 160 | { |
161 | 161 | |
162 | - $locales =config('contentful.use_preview')?config('contentful.locales_not_flatten_preview', ''):config('contentful.locales_not_flatten', ''); |
|
162 | + $locales = config('contentful.use_preview') ?config('contentful.locales_not_flatten_preview', '') : config('contentful.locales_not_flatten', ''); |
|
163 | 163 | |
164 | 164 | return explode(',', $locales); |
165 | 165 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function isEnabled(): bool |
173 | 173 | { |
174 | - return ! in_array($this->country . '_' . $this->locale, static::_getLocalesDisabled()); |
|
174 | + return !in_array($this->country.'_'.$this->locale, static::_getLocalesDisabled()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public static function getAcceptedLanguages(Request $request = null) |
226 | 226 | { |
227 | - $request = ! empty($request) ? $request : request(); |
|
227 | + $request = !empty($request) ? $request : request(); |
|
228 | 228 | |
229 | 229 | $languages = $request->server('HTTP_ACCEPT_LANGUAGE'); |
230 | - if (! empty($languages)) { |
|
230 | + if (!empty($languages)) { |
|
231 | 231 | preg_match_all('/(\W|^)([a-z]{2})([^a-z]|$)/six', $languages, $locales, PREG_PATTERN_ORDER); |
232 | 232 | |
233 | - if (! empty($locales) && ! empty($locales[2])) { |
|
233 | + if (!empty($locales) && !empty($locales[2])) { |
|
234 | 234 | return $locales[2]; |
235 | 235 | } |
236 | 236 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | { |
249 | 249 | $country = static::defaultCountry(); |
250 | 250 | $locales = static::getAcceptedLanguages($request); |
251 | - $locale = ! empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
251 | + $locale = !empty($locales) ? $locales[0] : config('app.fallback_locale'); |
|
252 | 252 | |
253 | 253 | $localeModel = (new static) |
254 | 254 | ->where('country', $country) |
@@ -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 | } |