Completed
Push — master ( 3a5d7a...6a4e8f )
by Maxime
05:51 queued 24s
created
src/Distilleries/Contentful/Models/Base/ContentfulModel.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.