@@ -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']) |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | protected function getBindingsSlug() : string |
| 55 | 55 | { |
| 56 | - if (! method_exists($this->model, 'query')) { |
|
| 56 | + if (!method_exists($this->model, 'query')) { |
|
| 57 | 57 | return ''; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | protected function getInAndNotInClauses(array $where) : string |
| 83 | 83 | { |
| 84 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 84 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 85 | 85 | return ""; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->currentBinding += count($where["values"]); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
| 96 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
| 97 | 97 | try { |
| 98 | 98 | $subquery = Uuid::fromBytes($subquery); |
| 99 | 99 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | protected function getLimitClause() : string |
| 115 | 115 | { |
| 116 | - if (! property_exists($this->query, "limit") |
|
| 117 | - || ! $this->query->limit |
|
| 116 | + if (!property_exists($this->query, "limit") |
|
| 117 | + || !$this->query->limit |
|
| 118 | 118 | ) { |
| 119 | 119 | return ""; |
| 120 | 120 | } |
@@ -129,17 +129,17 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | protected function getNestedClauses(array $where) : string |
| 131 | 131 | { |
| 132 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 132 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 133 | 133 | return ""; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
| 136 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | protected function getOffsetClause() : string |
| 140 | 140 | { |
| 141 | - if (! property_exists($this->query, "offset") |
|
| 142 | - || ! $this->query->offset |
|
| 141 | + if (!property_exists($this->query, "offset") |
|
| 142 | + || !$this->query->offset |
|
| 143 | 143 | ) { |
| 144 | 144 | return ""; |
| 145 | 145 | } |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | protected function getOrderByClauses() : string |
| 151 | 151 | { |
| 152 | - if (! property_exists($this->query, "orders") |
|
| 153 | - || ! $this->query->orders |
|
| 152 | + if (!property_exists($this->query, "orders") |
|
| 153 | + || !$this->query->orders |
|
| 154 | 154 | ) { |
| 155 | 155 | return ""; |
| 156 | 156 | } |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | $orders = collect($this->query->orders); |
| 159 | 159 | |
| 160 | 160 | return $orders |
| 161 | - ->reduce(function ($carry, $order) { |
|
| 161 | + ->reduce(function($carry, $order) { |
|
| 162 | 162 | if (($order["type"] ?? "") === "Raw") { |
| 163 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
| 163 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
| 166 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
| 167 | 167 | }) |
| 168 | 168 | ?: ""; |
| 169 | 169 | } |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | if (($columns === ["*"] |
| 186 | 186 | || $columns === []) |
| 187 | - && (! property_exists($this->query, "columns") |
|
| 188 | - || ! $this->query->columns) |
|
| 187 | + && (!property_exists($this->query, "columns") |
|
| 188 | + || !$this->query->columns) |
|
| 189 | 189 | ) { |
| 190 | 190 | return ""; |
| 191 | 191 | } |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | if (property_exists($this->query, "columns") |
| 194 | 194 | && $this->query->columns |
| 195 | 195 | ) { |
| 196 | - return "_" . implode("_", $this->query->columns); |
|
| 196 | + return "_".implode("_", $this->query->columns); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - return "_" . implode("_", $columns); |
|
| 199 | + return "_".implode("_", $columns); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | protected function getRawClauses(array $where) : string |
| 203 | 203 | { |
| 204 | - if (! in_array($where["type"], ["raw"])) { |
|
| 204 | + if (!in_array($where["type"], ["raw"])) { |
|
| 205 | 205 | return ""; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $clause = "_{$where["boolean"]}"; |
| 210 | 210 | |
| 211 | 211 | while (count($queryParts) > 1) { |
| 212 | - $clause .= "_" . array_shift($queryParts); |
|
| 212 | + $clause .= "_".array_shift($queryParts); |
|
| 213 | 213 | $clause .= $this->getCurrentBinding("where"); |
| 214 | 214 | $this->currentBinding++; |
| 215 | 215 | } |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | $lastPart = array_shift($queryParts); |
| 218 | 218 | |
| 219 | 219 | if ($lastPart) { |
| 220 | - $clause .= "_" . $lastPart; |
|
| 220 | + $clause .= "_".$lastPart; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - return "-" . str_replace(" ", "_", $clause); |
|
| 223 | + return "-".str_replace(" ", "_", $clause); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | protected function getTableSlug() : string |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | protected function getValuesClause(array $where = []) : string |
| 242 | 242 | { |
| 243 | - if (! $where |
|
| 243 | + if (!$where |
|
| 244 | 244 | || in_array($where["type"], ["NotNull", "Null"]) |
| 245 | 245 | ) { |
| 246 | 246 | return ""; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $values = $this->getValuesFromWhere($where); |
| 250 | 250 | $values = $this->getValuesFromBindings($where, $values); |
| 251 | 251 | |
| 252 | - return "_" . $values; |
|
| 252 | + return "_".$values; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | protected function getValuesFromWhere(array $where) : string |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | protected function getValuesFromBindings(array $where, string $values) : string |
| 276 | 276 | { |
| 277 | - $bindingFallback = __CLASS__ . ':UNKNOWN_BINDING'; |
|
| 277 | + $bindingFallback = __CLASS__.':UNKNOWN_BINDING'; |
|
| 278 | 278 | $currentBinding = $this->getCurrentBinding("where", $bindingFallback); |
| 279 | 279 | |
| 280 | 280 | if ($currentBinding !== $bindingFallback) { |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $this->currentBinding++; |
| 283 | 283 | |
| 284 | 284 | if ($where["type"] === "between") { |
| 285 | - $values .= "_" . $this->getCurrentBinding("where"); |
|
| 285 | + $values .= "_".$this->getCurrentBinding("where"); |
|
| 286 | 286 | $this->currentBinding++; |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | protected function getWhereClauses(array $wheres = []) : string |
| 300 | 300 | { |
| 301 | - return "" . $this->getWheres($wheres) |
|
| 302 | - ->reduce(function ($carry, $where) { |
|
| 301 | + return "".$this->getWheres($wheres) |
|
| 302 | + ->reduce(function($carry, $where) { |
|
| 303 | 303 | $value = $carry; |
| 304 | 304 | $value .= $this->getNestedClauses($where); |
| 305 | 305 | $value .= $this->getColumnClauses($where); |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | return ""; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
| 336 | - if (! method_exists($this->model, $related)) { |
|
| 335 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
| 336 | + if (!method_exists($this->model, $related)) { |
|
| 337 | 337 | return "{$carry}-{$related}"; |
| 338 | 338 | } |
| 339 | 339 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | continue; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - $result .= $glue . $value; |
|
| 368 | + $result .= $glue.$value; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | return $result; |