Passed
Push — master ( f210e5...c7d0c7 )
by Mike
02:17
created
src/Console/Commands/Flush.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         $option = $this->option('model');
13 13
 
14
-        if (! $option) {
14
+        if (!$option) {
15 15
             return $this->flushEntireCache();
16 16
         }
17 17
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $usesCachableTrait = collect(class_uses($model))
36 36
             ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable");
37 37
 
38
-        if (! $usesCachableTrait) {
38
+        if (!$usesCachableTrait) {
39 39
             $this->error("'{$option}' is not an instance of CachedModel.");
40 40
             $this->line("Only CachedModel instances can be flushed.");
41 41
 
Please login to merge, or discard this patch.
src/Traits/Cachable.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $usesCachableTrait = collect(class_uses($this))
35 35
             ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable");
36 36
 
37
-        if (! $usesCachableTrait) {
37
+        if (!$usesCachableTrait) {
38 38
             array_push($tags, str_slug(get_called_class()));
39 39
         }
40 40
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
         if ($cacheCooldown) {
62 62
             $cachePrefix = "genealabs:laravel-model-caching:"
63 63
                 . (config('laravel-model-caching.cache-prefix')
64
-                    ? config('laravel-model-caching.cache-prefix', '') . ":"
64
+                    ? config('laravel-model-caching.cache-prefix', '').":"
65 65
                     : "");
66 66
             $modelClassName = get_class($this);
67 67
             $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
68 68
 
69 69
             $this->cache()
70
-                ->rememberForever($cacheKey, function () {
70
+                ->rememberForever($cacheKey, function() {
71 71
                     return now();
72 72
                 });
73 73
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $cachePrefix = "genealabs:laravel-model-caching:"
100 100
             . (config('laravel-model-caching.cache-prefix')
101
-                ? config('laravel-model-caching.cache-prefix', '') . ":"
101
+                ? config('laravel-model-caching.cache-prefix', '').":"
102 102
                 : "");
103 103
         $modelClassName = get_class($instance);
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             ->cache()
107 107
             ->get("{$cachePrefix}:{$modelClassName}-cooldown:seconds");
108 108
 
109
-        if (! $cacheCooldown) {
109
+        if (!$cacheCooldown) {
110 110
             return [null, null, null];
111 111
         }
112 112
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance);
131 131
 
132
-        if (! $cacheCooldown
132
+        if (!$cacheCooldown
133 133
             || now()->diffInSeconds($invalidatedAt) < $cacheCooldown
134 134
         ) {
135 135
             return;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
         $cachePrefix = "genealabs:laravel-model-caching:"
139 139
             . (config('laravel-model-caching.cache-prefix')
140
-                ? config('laravel-model-caching.cache-prefix', '') . ":"
140
+                ? config('laravel-model-caching.cache-prefix', '').":"
141 141
                 : "");
142 142
         $modelClassName = get_class($instance);
143 143
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         [$cacheCooldown, $invalidatedAt, $savedAt] = $instance->getModelCacheCooldown($instance);
159 159
 
160
-        if (! $cacheCooldown) {
160
+        if (!$cacheCooldown) {
161 161
             $instance->flushCache();
162 162
 
163 163
             return;
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
     {
177 177
         $cachePrefix = "genealabs:laravel-model-caching:"
178 178
             . (config('laravel-model-caching.cache-prefix')
179
-                ? config('laravel-model-caching.cache-prefix', '') . ":"
179
+                ? config('laravel-model-caching.cache-prefix', '').":"
180 180
                 : "");
181 181
         $modelClassName = get_class($instance);
182 182
         $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at";
183 183
 
184 184
         $instance->cache()
185
-            ->rememberForever($cacheKey, function () {
185
+            ->rememberForever($cacheKey, function() {
186 186
                 return now();
187 187
             });
188 188
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     public static function bootCachable()
191 191
     {
192 192
         // TODO: add for deleted,updated,etc?
193
-        static::saved(function ($instance) {
193
+        static::saved(function($instance) {
194 194
             $instance->checkCooldownAndFlushAfterPersiting($instance);
195 195
         });
196 196
     }
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
         $key = $instance->makeCacheKey();
208 208
 
209 209
         return $instance->cache($tags)
210
-            ->rememberForever($key, function () use ($columns) {
210
+            ->rememberForever($key, function() use ($columns) {
211 211
                 return parent::all($columns);
212 212
             });
213 213
     }
214 214
 
215 215
     public function newEloquentBuilder($query)
216 216
     {
217
-        if (! $this->isCachable()) {
217
+        if (!$this->isCachable()) {
218 218
             $this->isCachable = true;
219 219
 
220 220
             return new EloquentBuilder($query);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     public function isCachable() : bool
227 227
     {
228 228
         return $this->isCachable
229
-            && ! config('laravel-model-caching.disabled');
229
+            && !config('laravel-model-caching.disabled');
230 230
     }
231 231
 
232 232
     public function scopeWithCacheCooldownSeconds(
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
     ) : EloquentBuilder {
236 236
         $cachePrefix = "genealabs:laravel-model-caching:"
237 237
             . (config('laravel-model-caching.cache-prefix')
238
-                ? config('laravel-model-caching.cache-prefix', '') . ":"
238
+                ? config('laravel-model-caching.cache-prefix', '').":"
239 239
                 : "");
240 240
         $modelClassName = get_class($this);
241 241
         $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds";
242 242
 
243 243
         $this->cache()
244
-            ->rememberForever($cacheKey, function () use ($seconds) {
244
+            ->rememberForever($cacheKey, function() use ($seconds) {
245 245
                 return $seconds;
246 246
             });
247 247
 
248 248
         $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at";
249 249
         $this->cache()
250
-            ->rememberForever($cacheKey, function () {
250
+            ->rememberForever($cacheKey, function() {
251 251
                 return now();
252 252
             });
253 253
 
Please login to merge, or discard this patch.