Completed
Push — master ( 21ffa2...ce2f02 )
by Mike
04:55 queued 02:25
created
src/CachedBuilder.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     protected function getLimitClause() : string
43 43
     {
44
-        if (! $this->query->limit) {
44
+        if (!$this->query->limit) {
45 45
             return '';
46 46
         }
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function getOffsetClause() : string
57 57
     {
58
-        if (! $this->query->offset) {
58
+        if (!$this->query->offset) {
59 59
             return '';
60 60
         }
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             return '';
69 69
         }
70 70
 
71
-        return '_' . implode('_', $columns);
71
+        return '_'.implode('_', $columns);
72 72
     }
73 73
 
74 74
     protected function getWhereClauses(array $wheres = []) : string
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $wheres = collect($this->query->wheres);
80 80
         }
81 81
 
82
-        return $wheres->reduce(function ($carry, $where) {
82
+        return $wheres->reduce(function($carry, $where) {
83 83
             if (in_array($where['type'], ['Exists', 'Nested'])) {
84 84
                 return $this->getWhereClauses($where['query']->wheres);
85 85
             }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             }
90 90
 
91 91
             if ($where['type'] === 'raw') {
92
-                return "_{$where['boolean']}_" . str_slug($where['sql']);
92
+                return "_{$where['boolean']}_".str_slug($where['sql']);
93 93
             }
94 94
 
95 95
             $value = array_get($where, 'value');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             }
100 100
 
101 101
             if (is_array(array_get($where, 'values'))) {
102
-                $value .= '_' . implode('_', $where['values']);
102
+                $value .= '_'.implode('_', $where['values']);
103 103
             }
104 104
 
105 105
             return "{$carry}-{$where['column']}_{$value}";
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
             return '';
115 115
         }
116 116
 
117
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
117
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
118 118
     }
119 119
 
120 120
     protected function getCacheTags() : array
121 121
     {
122 122
         return collect($this->eagerLoad)->keys()
123
-            ->map(function ($relationName) {
123
+            ->map(function($relationName) {
124 124
                 $relation = collect(explode('.', $relationName))
125
-                    ->reduce(function ($carry, $name) {
126
-                        if (! $carry) {
125
+                    ->reduce(function($carry, $name) {
126
+                        if (!$carry) {
127 127
                             $carry = $this->model;
128 128
                         }
129 129
 
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     public function avg($column)
145 145
     {
146 146
         $tags = [str_slug(get_class($this->model))];
147
-        $key = str_slug(get_class($this->model)) ."-avg_{$column}";
147
+        $key = str_slug(get_class($this->model))."-avg_{$column}";
148 148
 
149 149
         return $this->cache($tags)
150
-            ->rememberForever($key, function () use ($column) {
150
+            ->rememberForever($key, function() use ($column) {
151 151
                 return parent::avg($column);
152 152
             });
153 153
     }
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
     public function count($columns = ['*'])
156 156
     {
157 157
         $tags = [str_slug(get_class($this->model))];
158
-        $key = str_slug(get_class($this->model)) ."-count";
158
+        $key = str_slug(get_class($this->model))."-count";
159 159
 
160 160
         return $this->cache($tags)
161
-            ->rememberForever($key, function () use ($columns) {
161
+            ->rememberForever($key, function() use ($columns) {
162 162
                 return parent::count($columns);
163 163
             });
164 164
     }
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
     public function cursor()
167 167
     {
168 168
         $tags = [str_slug(get_class($this->model))];
169
-        $key = str_slug(get_class($this->model)) ."-cursor";
169
+        $key = str_slug(get_class($this->model))."-cursor";
170 170
 
171 171
         return $this->cache($tags)
172
-            ->rememberForever($key, function () {
172
+            ->rememberForever($key, function() {
173 173
                 return collect(parent::cursor());
174 174
             });
175 175
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $key = $this->getCacheKey($columns, $id);
184 184
 
185 185
         return $this->cache($tags)
186
-            ->rememberForever($key, function () use ($id, $columns) {
186
+            ->rememberForever($key, function() use ($id, $columns) {
187 187
                 return parent::find($id, $columns);
188 188
             });
189 189
     }
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
     public function first($columns = ['*'])
192 192
     {
193 193
         $tags = $this->getCacheTags();
194
-        $key = $this->getCacheKey($columns) . '-first';
194
+        $key = $this->getCacheKey($columns).'-first';
195 195
 
196 196
         return $this->cache($tags)
197
-            ->rememberForever($key, function () use ($columns) {
197
+            ->rememberForever($key, function() use ($columns) {
198 198
                 return parent::first($columns);
199 199
             });
200 200
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $key = $this->getCacheKey($columns);
206 206
 
207 207
         return $this->cache($tags)
208
-            ->rememberForever($key, function () use ($columns) {
208
+            ->rememberForever($key, function() use ($columns) {
209 209
                 return parent::get($columns);
210 210
             });
211 211
     }
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
     public function max($column)
214 214
     {
215 215
         $tags = [str_slug(get_class($this->model))];
216
-        $key = str_slug(get_class($this->model)) ."-max_{$column}";
216
+        $key = str_slug(get_class($this->model))."-max_{$column}";
217 217
 
218 218
         return $this->cache($tags)
219
-            ->rememberForever($key, function () use ($column) {
219
+            ->rememberForever($key, function() use ($column) {
220 220
                 return parent::max($column);
221 221
             });
222 222
     }
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
     public function min($column)
225 225
     {
226 226
         $tags = [str_slug(get_class($this->model))];
227
-        $key = str_slug(get_class($this->model)) ."-min_{$column}";
227
+        $key = str_slug(get_class($this->model))."-min_{$column}";
228 228
 
229 229
         return $this->cache($tags)
230
-            ->rememberForever($key, function () use ($column) {
230
+            ->rememberForever($key, function() use ($column) {
231 231
                 return parent::min($column);
232 232
             });
233 233
     }
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
     public function pluck($column, $key = null)
236 236
     {
237 237
         $tags = $this->getCacheTags();
238
-        $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}";
238
+        $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}";
239 239
 
240 240
         if ($key) {
241 241
             $cacheKey .= "_{$key}";
242 242
         }
243 243
 
244 244
         return $this->cache($tags)
245
-            ->rememberForever($cacheKey, function () use ($column, $key) {
245
+            ->rememberForever($cacheKey, function() use ($column, $key) {
246 246
                 return parent::pluck($column, $key);
247 247
             });
248 248
     }
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
     public function sum($column)
251 251
     {
252 252
         $tags = [str_slug(get_class($this->model))];
253
-        $key = str_slug(get_class($this->model)) ."-sum_{$column}";
253
+        $key = str_slug(get_class($this->model))."-sum_{$column}";
254 254
 
255 255
         return $this->cache($tags)
256
-            ->rememberForever($key, function () use ($column) {
256
+            ->rememberForever($key, function() use ($column) {
257 257
                 return parent::sum($column);
258 258
             });
259 259
     }
Please login to merge, or discard this patch.