Completed
Pull Request — master (#409)
by
unknown
36s
created
tests/Integration/CachedBuilder/BooleanTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         factory(Book::class)->create(['author_id' => $expectedAuthor->getKey(), 'title' => 'Mixed Clause']);
68 68
 
69 69
         $books = (new Book)
70
-            ->whereHas('author', function ($query) {
70
+            ->whereHas('author', function($query) {
71 71
                 return $query->where('is_famous', false);
72 72
             })
73 73
             ->whereRaw("title = ?", ['Mixed Clause']) // Test ensures this binding is included in the key
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             ->tags($tags)
77 77
             ->get($key)['value'];
78 78
         $liveResults = (new UncachedBook)
79
-            ->whereHas('author', function ($query) {
79
+            ->whereHas('author', function($query) {
80 80
                 return $query->where('is_famous', false);
81 81
             })
82 82
             ->whereRaw("title = ?", ['Mixed Clause'])
Please login to merge, or discard this patch.
src/CacheKey.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
     protected function getLimitClause() : string
60 60
     {
61
-        if (! property_exists($this->query, "limit")
62
-            || ! $this->query->limit
61
+        if (!property_exists($this->query, "limit")
62
+            || !$this->query->limit
63 63
         ) {
64 64
             return "";
65 65
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
     protected function getOffsetClause() : string
82 82
     {
83
-        if (! property_exists($this->query, "offset")
84
-            || ! $this->query->offset
83
+        if (!property_exists($this->query, "offset")
84
+            || !$this->query->offset
85 85
         ) {
86 86
             return "";
87 87
         }
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 
92 92
     protected function getOrderByClauses() : string
93 93
     {
94
-        if (! property_exists($this->query, "orders")
95
-            || ! $this->query->orders
94
+        if (!property_exists($this->query, "orders")
95
+            || !$this->query->orders
96 96
         ) {
97 97
             return "";
98 98
         }
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $orders = collect($this->query->orders);
101 101
 
102 102
         return $orders
103
-            ->reduce(function ($carry, $order) {
103
+            ->reduce(function($carry, $order) {
104 104
                 if (($order["type"] ?? "") === "Raw") {
105
-                    return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]);
105
+                    return $carry."_orderByRaw_".(new Str)->slug($order["sql"]);
106 106
                 }
107 107
 
108
-                return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"];
108
+                return $carry."_orderBy_".$order["column"]."_".$order["direction"];
109 109
             })
110 110
             ?: "";
111 111
     }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
     {
115 115
         if (($columns === ["*"]
116 116
                 || $columns === [])
117
-            && (! property_exists($this->query, "columns")
118
-                || ! $this->query->columns)
117
+            && (!property_exists($this->query, "columns")
118
+                || !$this->query->columns)
119 119
         ) {
120 120
             return "";
121 121
         }
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
         if (property_exists($this->query, "columns")
124 124
             && $this->query->columns
125 125
         ) {
126
-            return "_" . implode("_", $this->query->columns);
126
+            return "_".implode("_", $this->query->columns);
127 127
         }
128 128
 
129
-        return "_" . implode("_", $columns);
129
+        return "_".implode("_", $columns);
130 130
     }
131 131
 
132 132
     protected function getTypeClause($where) : string
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     protected function getValuesClause(array $where = []) : string
142 142
     {
143
-        if (! $where
143
+        if (!$where
144 144
             || in_array($where["type"], ["NotNull", "Null"])
145 145
         ) {
146 146
             return "";
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $values = $this->getValuesFromWhere($where);
150 150
         $values = $this->getValuesFromBindings($where, $values);
151 151
 
152
-        return "_" . $values;
152
+        return "_".$values;
153 153
     }
154 154
 
155 155
     protected function getValuesFromWhere(array $where) : string
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
     protected function getValuesFromBindings(array $where, string $values) : string
176 176
     {
177 177
         // Fallback to this when the current binding does not exist in the bindings array
178
-        $bindingFallback = __CLASS__ . ':UNKNOWN_BINDING';
178
+        $bindingFallback = __CLASS__.':UNKNOWN_BINDING';
179 179
 
180 180
         if (($this->query->bindings["where"][$this->currentBinding] ?? $bindingFallback) !== $bindingFallback) {
181 181
             $values = $this->query->bindings["where"][$this->currentBinding];
182 182
             $this->currentBinding++;
183 183
 
184 184
             if ($where["type"] === "between") {
185
-                $values .= "_" . $this->query->bindings["where"][$this->currentBinding];
185
+                $values .= "_".$this->query->bindings["where"][$this->currentBinding];
186 186
                 $this->currentBinding++;
187 187
             }
188 188
         }
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 
199 199
     protected function getWhereClauses(array $wheres = []) : string
200 200
     {
201
-        return "" . $this->getWheres($wheres)
202
-            ->reduce(function ($carry, $where) {
201
+        return "".$this->getWheres($wheres)
202
+            ->reduce(function($carry, $where) {
203 203
                 $value = $carry;
204 204
                 $value .= $this->getNestedClauses($where);
205 205
                 $value .= $this->getColumnClauses($where);
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 
214 214
     protected function getNestedClauses(array $where) : string
215 215
     {
216
-        if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) {
216
+        if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) {
217 217
             return "";
218 218
         }
219 219
 
220
-        return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres);
220
+        return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres);
221 221
     }
222 222
 
223 223
     protected function getColumnClauses(array $where) : string
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
     protected function getInAndNotInClauses(array $where) : string
233 233
     {
234
-        if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) {
234
+        if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) {
235 235
             return "";
236 236
         }
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $this->currentBinding += count($where["values"]);
244 244
         }
245 245
 
246
-        if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) {
246
+        if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) {
247 247
             try {
248 248
                 $subquery = Uuid::fromBytes($subquery);
249 249
                 $values = $this->recursiveImplode([$subquery], "_");
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 continue;
282 282
             }
283 283
 
284
-            $result .= $glue . $value;
284
+            $result .= $glue.$value;
285 285
         }
286 286
 
287 287
         return $result;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     protected function getRawClauses(array $where) : string
291 291
     {
292
-        if (! in_array($where["type"], ["raw"])) {
292
+        if (!in_array($where["type"], ["raw"])) {
293 293
             return "";
294 294
         }
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
         $clause = "_{$where["boolean"]}";
298 298
 
299 299
         while (count($queryParts) > 1) {
300
-            $clause .= "_" . array_shift($queryParts);
300
+            $clause .= "_".array_shift($queryParts);
301 301
             $clause .= $this->query->bindings["where"][$this->currentBinding];
302 302
             $this->currentBinding++;
303 303
         }
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
         $lastPart = array_shift($queryParts);
306 306
 
307 307
         if ($lastPart) {
308
-            $clause .= "_" . $lastPart;
308
+            $clause .= "_".$lastPart;
309 309
         }
310 310
 
311
-        return "-" . str_replace(" ", "_", $clause);
311
+        return "-".str_replace(" ", "_", $clause);
312 312
     }
313 313
 
314 314
     protected function getOtherClauses(array $where) : string
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
             return "";
345 345
         }
346 346
 
347
-        return $eagerLoads->keys()->reduce(function ($carry, $related) {
348
-            if (! method_exists($this->model, $related)) {
347
+        return $eagerLoads->keys()->reduce(function($carry, $related) {
348
+            if (!method_exists($this->model, $related)) {
349 349
                 return "{$carry}-{$related}";
350 350
             }
351 351
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
     protected function getBindingsSlug() : string
361 361
     {
362
-        if (! method_exists($this->model, 'query')) {
362
+        if (!method_exists($this->model, 'query')) {
363 363
             return '';
364 364
         }
365 365
 
Please login to merge, or discard this patch.