Completed
Push — master ( 38d62d...3576d4 )
by Maxime
02:21
created
src/Distilleries/Contentful/Helpers/NamspaceResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         if (!empty($class)) {
28 28
             $model = new $class;
29
-            return $model instanceof ContentfulModel?$model:null;
29
+            return $model instanceof ContentfulModel ? $model : null;
30 30
         }
31 31
 
32 32
         return null;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         foreach (config($key, []) as $namespace) {
56 56
             $modelClass = rtrim($namespace,
57
-                    '\\') . '\\' . ltrim(studly_case($element), '\\');
57
+                    '\\').'\\'.ltrim(studly_case($element), '\\');
58 58
 
59 59
             if (class_exists($modelClass)) {
60 60
                 return $modelClass;
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulModel.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@
 block discarded – undo
199 199
      *
200 200
      * @param  array|string|null $link
201 201
      * @param  mixed $query
202
-     * @param  mixed $field
202
+     * @param  string $field
203 203
      * @return \Distilleries\Contentful\Models\Base\ContentfulModel|null
204 204
      */
205 205
     protected function contentfulEntry($link, $query = null, $field = null): ?ContentfulModel
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulMapper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Locale.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.