Passed
Push — master ( c20c68...ebf3cb )
by Hamzah
04:06
created
src/Utility/AbstractRepository.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -258,14 +258,16 @@  discard block
 block discarded – undo
258 258
     {
259 259
         if($this->allowCaching)
260 260
         {
261
-            if (isset($this->cache[$entityId]))
262
-                return $this->cache[$entityId];
261
+            if (isset($this->cache[$entityId])) {
262
+                            return $this->cache[$entityId];
263
+            }
263 264
         }
264 265
 
265 266
         $entity = $this->model->with($this->with)->find($entityId, $columns);
266 267
 
267
-        if($this->allowCaching)
268
-            $this->cache[$entityId] = $entity;
268
+        if($this->allowCaching) {
269
+                    $this->cache[$entityId] = $entity;
270
+        }
269 271
 
270 272
         return $entity;
271 273
     }
@@ -282,14 +284,16 @@  discard block
 block discarded – undo
282 284
     {
283 285
         if($this->allowCaching)
284 286
         {
285
-            if (isset($this->cache[$entityId]))
286
-                return $this->cache[$entityId];
287
+            if (isset($this->cache[$entityId])) {
288
+                            return $this->cache[$entityId];
289
+            }
287 290
         }
288 291
 
289 292
         $entity = $this->model->with($this->with)->findOrFail($entityId, $columns);
290 293
 
291
-        if($this->allowCaching)
292
-            $this->cache[$entityId] = $entity;
294
+        if($this->allowCaching) {
295
+                    $this->cache[$entityId] = $entity;
296
+        }
293 297
 
294 298
         return $entity;
295 299
     }
@@ -304,14 +308,16 @@  discard block
 block discarded – undo
304 308
     {
305 309
         if($this->allowCaching)
306 310
         {
307
-            if (isset($this->cache['first']))
308
-                return $this->cache['first'];
311
+            if (isset($this->cache['first'])) {
312
+                            return $this->cache['first'];
313
+            }
309 314
         }
310 315
 
311 316
         $entity = $this->model->with($this->with)->select($columns)->where($filter)->first();
312 317
 
313
-        if($this->allowCaching)
314
-            $this->cache['first'] = $entity;
318
+        if($this->allowCaching) {
319
+                    $this->cache['first'] = $entity;
320
+        }
315 321
 
316 322
         return $entity;
317 323
     }
@@ -326,15 +332,17 @@  discard block
 block discarded – undo
326 332
     {
327 333
         if($this->allowCaching)
328 334
         {
329
-            if (isset($this->cache['last']))
330
-                return $this->cache['last'];
335
+            if (isset($this->cache['last'])) {
336
+                            return $this->cache['last'];
337
+            }
331 338
         }
332 339
 
333 340
         $entity = $this->model->with($this->with)->select($columns)->where($filter)
334 341
             ->orderBy('id','desc')->first();
335 342
 
336
-        if($this->allowCaching)
337
-            $this->cache['last'] = $entity;
343
+        if($this->allowCaching) {
344
+                    $this->cache['last'] = $entity;
345
+        }
338 346
 
339 347
         return $entity;
340 348
     }
Please login to merge, or discard this patch.