Completed
Push — master ( efaeb5...ff303d )
by Mike
15s queued 12s
created
src/Traits/Caching.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
 
44 44
     protected function applyScopesToInstance()
45 45
     {
46
-        if (! property_exists($this, "scopes")
46
+        if (!property_exists($this, "scopes")
47 47
             || $this->scopesAreApplied
48 48
         ) {
49 49
             return;
50 50
         }
51 51
 
52 52
         foreach ($this->scopes as $identifier => $scope) {
53
-            if (! isset($this->scopes[$identifier])) {
53
+            if (!isset($this->scopes[$identifier])) {
54 54
                 continue;
55 55
             }
56 56
 
57
-            $this->callScope(function () use ($scope) {
57
+            $this->callScope(function() use ($scope) {
58 58
                 if ($scope instanceof Closure) {
59 59
                     $scope($this);
60 60
                 }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
113 113
 
114 114
             $this->cache()
115
-                ->rememberForever($cacheKey, function () {
115
+                ->rememberForever($cacheKey, function() {
116 116
                     return (new Carbon)->now();
117 117
                 });
118 118
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
     public function getModelCacheCooldown(Model $instance) : array
191 191
     {
192
-        if (! $instance->cacheCooldownSeconds) {
192
+        if (!$instance->cacheCooldownSeconds) {
193 193
             return [null, null, null];
194 194
         }
195 195
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         [$cacheCooldown, $invalidatedAt, $savedAt] = $this
199 199
             ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName);
200 200
 
201
-        if (! $cacheCooldown || $cacheCooldown === 0) {
201
+        if (!$cacheCooldown || $cacheCooldown === 0) {
202 202
             return [null, null, null];
203 203
         }
204 204
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance);
229 229
 
230
-        if (! $cacheCooldown
230
+        if (!$cacheCooldown
231 231
             || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown
232 232
         ) {
233 233
             return;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     {
253 253
         [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance);
254 254
 
255
-        if (! $cacheCooldown) {
255
+        if (!$cacheCooldown) {
256 256
             $instance->flushCache();
257 257
 
258 258
             if ($relationship) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     public function isCachable() : bool
281 281
     {
282
-        $isCacheDisabled = ! Container::getInstance()
282
+        $isCacheDisabled = !Container::getInstance()
283 283
             ->make("config")
284 284
             ->get("laravel-model-caching.enabled");
285 285
         $allRelationshipsAreCachable = true;
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
             $allRelationshipsAreCachable = collect($this
291 291
                 ->eagerLoad)
292 292
                 ->keys()
293
-                ->reduce(function ($carry, $related) {
294
-                    if (! method_exists($this->model, $related)
293
+                ->reduce(function($carry, $related) {
294
+                    if (!method_exists($this->model, $related)
295 295
                         || $carry === false
296 296
                     ) {
297 297
                         return $carry;
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
         
300 300
                     $relatedModel = $this->model->$related()->getRelated();
301 301
 
302
-                    if (! method_exists($relatedModel, "isCachable")
303
-                        || ! $relatedModel->isCachable()
302
+                    if (!method_exists($relatedModel, "isCachable")
303
+                        || !$relatedModel->isCachable()
304 304
                     ) {
305 305
                         return false;
306 306
                     }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         return $this->isCachable
314
-            && ! $isCacheDisabled
314
+            && !$isCacheDisabled
315 315
             && $allRelationshipsAreCachable;
316 316
     }
317 317
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
323 323
 
324 324
         $instance->cache()
325
-            ->rememberForever($cacheKey, function () {
325
+            ->rememberForever($cacheKey, function() {
326 326
                 return (new Carbon)->now();
327 327
             });
328 328
     }
Please login to merge, or discard this patch.