Completed
Push — master ( 422cc6...fa70a6 )
by Mike
07:12 queued 02:18
created
src/CachedBuilder.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     protected function getLimitClause() : string
42 42
     {
43
-        if (! $this->query->limit) {
43
+        if (!$this->query->limit) {
44 44
             return '';
45 45
         }
46 46
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     protected function getOffsetClause() : string
56 56
     {
57
-        if (! $this->query->offset) {
57
+        if (!$this->query->offset) {
58 58
             return '';
59 59
         }
60 60
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
             return '';
68 68
         }
69 69
 
70
-        return '_' . implode('_', $columns);
70
+        return '_'.implode('_', $columns);
71 71
     }
72 72
 
73 73
     protected function getWhereClauses() : string
74 74
     {
75
-        return collect($this->query->wheres)->reduce(function ($carry, $where) {
75
+        return collect($this->query->wheres)->reduce(function($carry, $where) {
76 76
             $value = $where['value'] ?? implode('_', ($where['values'] ?? []));
77 77
 
78 78
             return "{$carry}-{$where['column']}_{$value}";
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
             return '';
88 88
         }
89 89
 
90
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
90
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
91 91
     }
92 92
 
93 93
     protected function getCacheTags() : array
94 94
     {
95 95
         return collect($this->eagerLoad)->keys()
96
-            ->map(function ($relationName) {
96
+            ->map(function($relationName) {
97 97
                 $relation = collect(explode('.', $relationName))
98
-                    ->reduce(function ($carry, $name) {
99
-                        if (! $carry) {
98
+                    ->reduce(function($carry, $name) {
99
+                        if (!$carry) {
100 100
                             $carry = $this->model;
101 101
                         }
102 102
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
     public function avg($column)
118 118
     {
119 119
         $tags = [str_slug(get_class($this->model))];
120
-        $key = str_slug(get_class($this->model)) ."-avg_{$column}";
120
+        $key = str_slug(get_class($this->model))."-avg_{$column}";
121 121
 
122 122
         return $this->cache($tags)
123
-            ->rememberForever($key, function () use ($column) {
123
+            ->rememberForever($key, function() use ($column) {
124 124
                 return parent::avg($column);
125 125
             });
126 126
     }
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
     public function count($columns = ['*'])
129 129
     {
130 130
         $tags = [str_slug(get_class($this->model))];
131
-        $key = str_slug(get_class($this->model)) ."-count";
131
+        $key = str_slug(get_class($this->model))."-count";
132 132
 
133 133
         return $this->cache($tags)
134
-            ->rememberForever($key, function () use ($columns) {
134
+            ->rememberForever($key, function() use ($columns) {
135 135
                 return parent::count($columns);
136 136
             });
137 137
     }
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
     public function cursor()
140 140
     {
141 141
         $tags = [str_slug(get_class($this->model))];
142
-        $key = str_slug(get_class($this->model)) ."-cursor";
142
+        $key = str_slug(get_class($this->model))."-cursor";
143 143
 
144 144
         return $this->cache($tags)
145
-            ->rememberForever($key, function () {
145
+            ->rememberForever($key, function() {
146 146
                 return collect(parent::cursor());
147 147
             });
148 148
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $key = $this->getCacheKey($columns, $id);
157 157
 
158 158
         return $this->cache($tags)
159
-            ->rememberForever($key, function () use ($id, $columns) {
159
+            ->rememberForever($key, function() use ($id, $columns) {
160 160
                 return parent::find($id, $columns);
161 161
             });
162 162
     }
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
     public function first($columns = ['*'])
165 165
     {
166 166
         $tags = $this->getCacheTags();
167
-        $key = $this->getCacheKey($columns) . '-first';
167
+        $key = $this->getCacheKey($columns).'-first';
168 168
 
169 169
         return $this->cache($tags)
170
-            ->rememberForever($key, function () use ($columns) {
170
+            ->rememberForever($key, function() use ($columns) {
171 171
                 return parent::first($columns);
172 172
             });
173 173
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $key = $this->getCacheKey($columns);
179 179
 
180 180
         return $this->cache($tags)
181
-            ->rememberForever($key, function () use ($columns) {
181
+            ->rememberForever($key, function() use ($columns) {
182 182
                 return parent::get($columns);
183 183
             });
184 184
     }
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
     public function max($column)
187 187
     {
188 188
         $tags = [str_slug(get_class($this->model))];
189
-        $key = str_slug(get_class($this->model)) ."-max_{$column}";
189
+        $key = str_slug(get_class($this->model))."-max_{$column}";
190 190
 
191 191
         return $this->cache($tags)
192
-            ->rememberForever($key, function () use ($column) {
192
+            ->rememberForever($key, function() use ($column) {
193 193
                 return parent::max($column);
194 194
             });
195 195
     }
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
     public function min($column)
198 198
     {
199 199
         $tags = [str_slug(get_class($this->model))];
200
-        $key = str_slug(get_class($this->model)) ."-min_{$column}";
200
+        $key = str_slug(get_class($this->model))."-min_{$column}";
201 201
 
202 202
         return $this->cache($tags)
203
-            ->rememberForever($key, function () use ($column) {
203
+            ->rememberForever($key, function() use ($column) {
204 204
                 return parent::min($column);
205 205
             });
206 206
     }
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
     public function pluck($column, $key = null)
209 209
     {
210 210
         $tags = $this->getCacheTags();
211
-        $cacheKey = $this->getCacheKey([$column]) . "-pluck_{$column}";
211
+        $cacheKey = $this->getCacheKey([$column])."-pluck_{$column}";
212 212
 
213 213
         if ($key) {
214 214
             $cacheKey .= "_{$key}";
215 215
         }
216 216
 
217 217
         return $this->cache($tags)
218
-            ->rememberForever($cacheKey, function () use ($column, $key) {
218
+            ->rememberForever($cacheKey, function() use ($column, $key) {
219 219
                 return parent::pluck($column, $key);
220 220
             });
221 221
     }
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
     public function sum($column)
224 224
     {
225 225
         $tags = [str_slug(get_class($this->model))];
226
-        $key = str_slug(get_class($this->model)) ."-sum_{$column}";
226
+        $key = str_slug(get_class($this->model))."-sum_{$column}";
227 227
 
228 228
         return $this->cache($tags)
229
-            ->rememberForever($key, function () use ($column) {
229
+            ->rememberForever($key, function() use ($column) {
230 230
                 return parent::sum($column);
231 231
             });
232 232
     }
Please login to merge, or discard this patch.