Completed
Push — master ( 7c4b04...3b0324 )
by Mike
34s
created
src/Traits/Caching.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     protected function applyScopesToInstance()
49 49
     {
50 50
         if (
51
-            ! property_exists($this, "scopes")
51
+            !property_exists($this, "scopes")
52 52
             || $this->scopesAreApplied
53 53
             || $this->withoutAllGlobalScopes
54 54
         ) {
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 
58 58
         foreach ($this->scopes as $identifier => $scope) {
59 59
             if (
60
-                ! isset($this->scopes[$identifier])
60
+                !isset($this->scopes[$identifier])
61 61
                 || isset($this->withoutGlobalScopes[$identifier])
62 62
             ) {
63 63
                 continue;
64 64
             }
65 65
 
66
-            $this->callScope(function () use ($scope) {
66
+            $this->callScope(function() use ($scope) {
67 67
                 if ($scope instanceof Closure) {
68 68
                     $scope($this);
69 69
                 }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
123 123
 
124 124
             $this->cache()
125
-                ->rememberForever($cacheKey, function () {
125
+                ->rememberForever($cacheKey, function() {
126 126
                     return (new Carbon)->now();
127 127
                 });
128 128
         }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
     public function getModelCacheCooldown(Model $instance) : array
203 203
     {
204
-        if (! $instance->cacheCooldownSeconds) {
204
+        if (!$instance->cacheCooldownSeconds) {
205 205
             return [null, null, null];
206 206
         }
207 207
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         [$cacheCooldown, $invalidatedAt, $savedAt] = $this
211 211
             ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName);
212 212
 
213
-        if (! $cacheCooldown || $cacheCooldown === 0) {
213
+        if (!$cacheCooldown || $cacheCooldown === 0) {
214 214
             return [null, null, null];
215 215
         }
216 216
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance);
241 241
 
242 242
         if (
243
-            ! $cacheCooldown
243
+            !$cacheCooldown
244 244
             || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown
245 245
         ) {
246 246
             return;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance);
267 267
 
268
-        if (! $cacheCooldown) {
268
+        if (!$cacheCooldown) {
269 269
             $instance->flushCache();
270 270
 
271 271
             if ($relationship) {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
     public function isCachable() : bool
294 294
     {
295
-        $isCacheDisabled = ! Container::getInstance()
295
+        $isCacheDisabled = !Container::getInstance()
296 296
             ->make("config")
297 297
             ->get("laravel-model-caching.enabled");
298 298
         $allRelationshipsAreCachable = true;
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
             $allRelationshipsAreCachable = collect($this
305 305
                 ->eagerLoad)
306 306
                 ->keys()
307
-                ->reduce(function ($carry, $related) {
307
+                ->reduce(function($carry, $related) {
308 308
                     if (
309
-                        ! method_exists($this->model, $related)
309
+                        !method_exists($this->model, $related)
310 310
                         || $carry === false
311 311
                     ) {
312 312
                         return $carry;
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
                     $relatedModel = $this->model->$related()->getRelated();
316 316
 
317 317
                     if (
318
-                        ! method_exists($relatedModel, "isCachable")
319
-                        || ! $relatedModel->isCachable()
318
+                        !method_exists($relatedModel, "isCachable")
319
+                        || !$relatedModel->isCachable()
320 320
                     ) {
321 321
                         return false;
322 322
                     }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         }
328 328
 
329 329
         return $this->isCachable
330
-            && ! $isCacheDisabled
330
+            && !$isCacheDisabled
331 331
             && $allRelationshipsAreCachable;
332 332
     }
333 333
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
339 339
 
340 340
         $instance->cache()
341
-            ->rememberForever($cacheKey, function () {
341
+            ->rememberForever($cacheKey, function() {
342 342
                 return (new Carbon)->now();
343 343
             });
344 344
     }
Please login to merge, or discard this patch.