@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function getBindingsSlug() : string |
62 | 62 | { |
63 | - if (! method_exists($this->model, 'query')) { |
|
63 | + if (!method_exists($this->model, 'query')) { |
|
64 | 64 | return ''; |
65 | 65 | } |
66 | 66 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | protected function getHavingClauses() |
93 | 93 | { |
94 | - return Collection::make($this->query->havings)->reduce(function ($carry, $having) { |
|
94 | + return Collection::make($this->query->havings)->reduce(function($carry, $having) { |
|
95 | 95 | $value = $carry; |
96 | 96 | $value .= $this->getHavingClause($having); |
97 | 97 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $return = '-having'; |
105 | 105 | |
106 | 106 | foreach ($having as $key => $value) { |
107 | - $return .= '_' . $key . '_' . str_replace(' ', '_', $value); |
|
107 | + $return .= '_'.$key.'_'.str_replace(' ', '_', $value); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $return; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | protected function getInAndNotInClauses(array $where) : string |
119 | 119 | { |
120 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
120 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
121 | 121 | return ""; |
122 | 122 | } |
123 | 123 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $this->currentBinding += count($where["values"]); |
130 | 130 | } |
131 | 131 | |
132 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
132 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
133 | 133 | try { |
134 | 134 | $subquery = Uuid::fromBytes($subquery); |
135 | 135 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | |
150 | 150 | protected function getLimitClause() : string |
151 | 151 | { |
152 | - if (! property_exists($this->query, "limit") |
|
153 | - || ! $this->query->limit |
|
152 | + if (!property_exists($this->query, "limit") |
|
153 | + || !$this->query->limit |
|
154 | 154 | ) { |
155 | 155 | return ""; |
156 | 156 | } |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | protected function getNestedClauses(array $where) : string |
167 | 167 | { |
168 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
168 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
169 | 169 | return ""; |
170 | 170 | } |
171 | 171 | |
172 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
172 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | protected function getOffsetClause() : string |
176 | 176 | { |
177 | - if (! property_exists($this->query, "offset") |
|
178 | - || ! $this->query->offset |
|
177 | + if (!property_exists($this->query, "offset") |
|
178 | + || !$this->query->offset |
|
179 | 179 | ) { |
180 | 180 | return ""; |
181 | 181 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | protected function getOrderByClauses() : string |
187 | 187 | { |
188 | - if (! property_exists($this->query, "orders") |
|
189 | - || ! $this->query->orders |
|
188 | + if (!property_exists($this->query, "orders") |
|
189 | + || !$this->query->orders |
|
190 | 190 | ) { |
191 | 191 | return ""; |
192 | 192 | } |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | $orders = collect($this->query->orders); |
195 | 195 | |
196 | 196 | return $orders |
197 | - ->reduce(function ($carry, $order) { |
|
197 | + ->reduce(function($carry, $order) { |
|
198 | 198 | if (($order["type"] ?? "") === "Raw") { |
199 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
199 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
200 | 200 | } |
201 | 201 | |
202 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
202 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
203 | 203 | }) |
204 | 204 | ?: ""; |
205 | 205 | } |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | { |
225 | 225 | if (($columns === ["*"] |
226 | 226 | || $columns === []) |
227 | - && (! property_exists($this->query, "columns") |
|
228 | - || ! $this->query->columns) |
|
227 | + && (!property_exists($this->query, "columns") |
|
228 | + || !$this->query->columns) |
|
229 | 229 | ) { |
230 | 230 | return ""; |
231 | 231 | } |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | if (property_exists($this->query, "columns") |
234 | 234 | && $this->query->columns |
235 | 235 | ) { |
236 | - return "_" . implode("_", $this->query->columns); |
|
236 | + return "_".implode("_", $this->query->columns); |
|
237 | 237 | } |
238 | 238 | |
239 | - return "_" . implode("_", $columns); |
|
239 | + return "_".implode("_", $columns); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | protected function getRawClauses(array $where) : string |
243 | 243 | { |
244 | - if (! in_array($where["type"], ["raw"])) { |
|
244 | + if (!in_array($where["type"], ["raw"])) { |
|
245 | 245 | return ""; |
246 | 246 | } |
247 | 247 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $clause = "_{$where["boolean"]}"; |
250 | 250 | |
251 | 251 | while (count($queryParts) > 1) { |
252 | - $clause .= "_" . array_shift($queryParts); |
|
252 | + $clause .= "_".array_shift($queryParts); |
|
253 | 253 | $clause .= $this->getCurrentBinding("where"); |
254 | 254 | $this->currentBinding++; |
255 | 255 | } |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | $lastPart = array_shift($queryParts); |
258 | 258 | |
259 | 259 | if ($lastPart) { |
260 | - $clause .= "_" . $lastPart; |
|
260 | + $clause .= "_".$lastPart; |
|
261 | 261 | } |
262 | 262 | |
263 | - return "-" . str_replace(" ", "_", $clause); |
|
263 | + return "-".str_replace(" ", "_", $clause); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | protected function getTableSlug() : string |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | protected function getValuesClause(array $where = []) : string |
282 | 282 | { |
283 | - if (! $where |
|
283 | + if (!$where |
|
284 | 284 | || in_array($where["type"], ["NotNull", "Null"]) |
285 | 285 | ) { |
286 | 286 | return ""; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $values = $this->getValuesFromWhere($where); |
290 | 290 | $values = $this->getValuesFromBindings($where, $values); |
291 | 291 | |
292 | - return "_" . $values; |
|
292 | + return "_".$values; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | protected function getValuesFromWhere(array $where) : string |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | protected function getValuesFromBindings(array $where, string $values) : string |
320 | 320 | { |
321 | - $bindingFallback = __CLASS__ . ':UNKNOWN_BINDING'; |
|
321 | + $bindingFallback = __CLASS__.':UNKNOWN_BINDING'; |
|
322 | 322 | $currentBinding = $this->getCurrentBinding("where", $bindingFallback); |
323 | 323 | |
324 | 324 | if ($currentBinding !== $bindingFallback) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $this->currentBinding++; |
327 | 327 | |
328 | 328 | if ($where["type"] === "between") { |
329 | - $values .= "_" . $this->getCurrentBinding("where"); |
|
329 | + $values .= "_".$this->getCurrentBinding("where"); |
|
330 | 330 | $this->currentBinding++; |
331 | 331 | } |
332 | 332 | } |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | protected function getWhereClauses(array $wheres = []) : string |
344 | 344 | { |
345 | - return "" . $this->getWheres($wheres) |
|
346 | - ->reduce(function ($carry, $where) { |
|
345 | + return "".$this->getWheres($wheres) |
|
346 | + ->reduce(function($carry, $where) { |
|
347 | 347 | $value = $carry; |
348 | 348 | $value .= $this->getNestedClauses($where); |
349 | 349 | $value .= $this->getColumnClauses($where); |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | return ""; |
377 | 377 | } |
378 | 378 | |
379 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
380 | - if (! method_exists($this->model, $related)) { |
|
379 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
380 | + if (!method_exists($this->model, $related)) { |
|
381 | 381 | return "{$carry}-{$related}"; |
382 | 382 | } |
383 | 383 | |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | continue; |
410 | 410 | } |
411 | 411 | |
412 | - $result .= $glue . $value; |
|
412 | + $result .= $glue.$value; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | return $result; |
416 | 416 | } |
417 | 417 | |
418 | - private function processEnum(\BackedEnum|\UnitEnum|string $value): string |
|
418 | + private function processEnum(\BackedEnum | \UnitEnum | string $value): string |
|
419 | 419 | { |
420 | 420 | if ($value instanceof \BackedEnum) { |
421 | 421 | return $value->value; |