@@ -67,7 +67,7 @@ discard block |
||
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 |
||
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']) |
@@ -58,8 +58,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,7 +175,7 @@ discard block |
||
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 | $currentBinding = $this->getCurrentBinding('where') ?? $bindingFallback; |
180 | 180 | |
181 | 181 | if ($currentBinding !== $bindingFallback) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $this->currentBinding++; |
184 | 184 | |
185 | 185 | if ($where["type"] === "between") { |
186 | - $values .= "_" . $this->getCurrentBinding('where'); |
|
186 | + $values .= "_".$this->getCurrentBinding('where'); |
|
187 | 187 | $this->currentBinding++; |
188 | 188 | } |
189 | 189 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | |
200 | 200 | protected function getWhereClauses(array $wheres = []) : string |
201 | 201 | { |
202 | - return "" . $this->getWheres($wheres) |
|
203 | - ->reduce(function ($carry, $where) { |
|
202 | + return "".$this->getWheres($wheres) |
|
203 | + ->reduce(function($carry, $where) { |
|
204 | 204 | $value = $carry; |
205 | 205 | $value .= $this->getNestedClauses($where); |
206 | 206 | $value .= $this->getColumnClauses($where); |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | |
215 | 215 | protected function getNestedClauses(array $where) : string |
216 | 216 | { |
217 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
217 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
218 | 218 | return ""; |
219 | 219 | } |
220 | 220 | |
221 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
221 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | protected function getColumnClauses(array $where) : string |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | protected function getInAndNotInClauses(array $where) : string |
234 | 234 | { |
235 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
235 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
236 | 236 | return ""; |
237 | 237 | } |
238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $this->currentBinding += count($where["values"]); |
245 | 245 | } |
246 | 246 | |
247 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
247 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
248 | 248 | try { |
249 | 249 | $subquery = Uuid::fromBytes($subquery); |
250 | 250 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | |
285 | - $result .= $glue . $value; |
|
285 | + $result .= $glue.$value; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $result; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | protected function getRawClauses(array $where) : string |
292 | 292 | { |
293 | - if (! in_array($where["type"], ["raw"])) { |
|
293 | + if (!in_array($where["type"], ["raw"])) { |
|
294 | 294 | return ""; |
295 | 295 | } |
296 | 296 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $clause = "_{$where["boolean"]}"; |
299 | 299 | |
300 | 300 | while (count($queryParts) > 1) { |
301 | - $clause .= "_" . array_shift($queryParts); |
|
301 | + $clause .= "_".array_shift($queryParts); |
|
302 | 302 | $clause .= $this->getCurrentBinding('where'); |
303 | 303 | $this->currentBinding++; |
304 | 304 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | $lastPart = array_shift($queryParts); |
307 | 307 | |
308 | 308 | if ($lastPart) { |
309 | - $clause .= "_" . $lastPart; |
|
309 | + $clause .= "_".$lastPart; |
|
310 | 310 | } |
311 | 311 | |
312 | - return "-" . str_replace(" ", "_", $clause); |
|
312 | + return "-".str_replace(" ", "_", $clause); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | protected function getOtherClauses(array $where) : string |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | return ""; |
346 | 346 | } |
347 | 347 | |
348 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
349 | - if (! method_exists($this->model, $related)) { |
|
348 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
349 | + if (!method_exists($this->model, $related)) { |
|
350 | 350 | return "{$carry}-{$related}"; |
351 | 351 | } |
352 | 352 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | protected function getBindingsSlug() : string |
362 | 362 | { |
363 | - if (! method_exists($this->model, 'query')) { |
|
363 | + if (!method_exists($this->model, 'query')) { |
|
364 | 364 | return ''; |
365 | 365 | } |
366 | 366 |