@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | public function avg($column) |
| 9 | 9 | { |
| 10 | - if (! $this->isCachable()) { |
|
| 10 | + if (!$this->isCachable()) { |
|
| 11 | 11 | return parent::avg($column); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function count($columns = "*") |
| 20 | 20 | { |
| 21 | - if (! $this->isCachable()) { |
|
| 21 | + if (!$this->isCachable()) { |
|
| 22 | 22 | return parent::count($columns); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function find($id, $columns = ["*"]) |
| 50 | 50 | { |
| 51 | - if (! $this->isCachable()) { |
|
| 51 | + if (!$this->isCachable()) { |
|
| 52 | 52 | return parent::find($id, $columns); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function first($columns = ["*"]) |
| 66 | 66 | { |
| 67 | - if (! $this->isCachable()) { |
|
| 67 | + if (!$this->isCachable()) { |
|
| 68 | 68 | return parent::first($columns); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function get($columns = ["*"]) |
| 85 | 85 | { |
| 86 | - if (! $this->isCachable()) { |
|
| 86 | + if (!$this->isCachable()) { |
|
| 87 | 87 | return parent::get($columns); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function max($column) |
| 118 | 118 | { |
| 119 | - if (! $this->isCachable()) { |
|
| 119 | + if (!$this->isCachable()) { |
|
| 120 | 120 | return parent::max($column); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function min($column) |
| 129 | 129 | { |
| 130 | - if (! $this->isCachable()) { |
|
| 130 | + if (!$this->isCachable()) { |
|
| 131 | 131 | return parent::min($column); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $pageName = "page", |
| 143 | 143 | $page = null |
| 144 | 144 | ) { |
| 145 | - if (! $this->isCachable()) { |
|
| 145 | + if (!$this->isCachable()) { |
|
| 146 | 146 | return parent::paginate($perPage, $columns, $pageName, $page); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $result = ""; |
| 164 | 164 | |
| 165 | 165 | foreach ($items as $key => $value) { |
| 166 | - $result .= $glue . $key . $glue . $value; |
|
| 166 | + $result .= $glue.$key.$glue.$value; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return $result; |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | public function pluck($column, $key = null) |
| 173 | 173 | { |
| 174 | - if (! $this->isCachable()) { |
|
| 174 | + if (!$this->isCachable()) { |
|
| 175 | 175 | return parent::pluck($column, $key); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
| 178 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
| 179 | 179 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
| 180 | 180 | |
| 181 | 181 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | public function sum($column) |
| 185 | 185 | { |
| 186 | - if (! $this->isCachable()) { |
|
| 186 | + if (!$this->isCachable()) { |
|
| 187 | 187 | return parent::sum($column); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | public function value($column) |
| 203 | 203 | { |
| 204 | - if (! $this->isCachable()) { |
|
| 204 | + if (!$this->isCachable()) { |
|
| 205 | 205 | return parent::value($column); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | return $this->cache($cacheTags) |
| 277 | 277 | ->rememberForever( |
| 278 | 278 | $hashedCacheKey, |
| 279 | - function () use ($arguments, $cacheKey, $method) { |
|
| 279 | + function() use ($arguments, $cacheKey, $method) { |
|
| 280 | 280 | return [ |
| 281 | 281 | "key" => $cacheKey, |
| 282 | 282 | "value" => parent::{$method}(...$arguments), |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | protected function getLimitClause() : string |
| 54 | 54 | { |
| 55 | - if (! property_exists($this->query, "limit") |
|
| 56 | - || ! $this->query->limit |
|
| 55 | + if (!property_exists($this->query, "limit") |
|
| 56 | + || !$this->query->limit |
|
| 57 | 57 | ) { |
| 58 | 58 | return ""; |
| 59 | 59 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | protected function getOffsetClause() : string |
| 76 | 76 | { |
| 77 | - if (! property_exists($this->query, "offset") |
|
| 78 | - || ! $this->query->offset |
|
| 77 | + if (!property_exists($this->query, "offset") |
|
| 78 | + || !$this->query->offset |
|
| 79 | 79 | ) { |
| 80 | 80 | return ""; |
| 81 | 81 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | protected function getOrderByClauses() : string |
| 87 | 87 | { |
| 88 | - if (! property_exists($this->query, "orders") |
|
| 89 | - || ! $this->query->orders |
|
| 88 | + if (!property_exists($this->query, "orders") |
|
| 89 | + || !$this->query->orders |
|
| 90 | 90 | ) { |
| 91 | 91 | return ""; |
| 92 | 92 | } |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | $orders = collect($this->query->orders); |
| 95 | 95 | |
| 96 | 96 | return $orders |
| 97 | - ->reduce(function ($carry, $order) { |
|
| 97 | + ->reduce(function($carry, $order) { |
|
| 98 | 98 | if (($order["type"] ?? "") === "Raw") { |
| 99 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
| 99 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
| 102 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
| 103 | 103 | }) |
| 104 | 104 | ?: ""; |
| 105 | 105 | } |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | if (($columns === ["*"] |
| 110 | 110 | || $columns === []) |
| 111 | - && (! property_exists($this->query, "columns") |
|
| 112 | - || ! $this->query->columns) |
|
| 111 | + && (!property_exists($this->query, "columns") |
|
| 112 | + || !$this->query->columns) |
|
| 113 | 113 | ) { |
| 114 | 114 | return ""; |
| 115 | 115 | } |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | if (property_exists($this->query, "columns") |
| 118 | 118 | && $this->query->columns |
| 119 | 119 | ) { |
| 120 | - return "_" . implode("_", $this->query->columns); |
|
| 120 | + return "_".implode("_", $this->query->columns); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return "_" . implode("_", $columns); |
|
| 123 | + return "_".implode("_", $columns); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | protected function getTypeClause($where) : string |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | protected function getValuesClause(array $where = []) : string |
| 136 | 136 | { |
| 137 | - if (! $where |
|
| 137 | + if (!$where |
|
| 138 | 138 | || in_array($where["type"], ["NotNull", "Null"]) |
| 139 | 139 | ) { |
| 140 | 140 | return ""; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $values = $this->getValuesFromWhere($where); |
| 144 | 144 | $values = $this->getValuesFromBindings($where, $values); |
| 145 | 145 | |
| 146 | - return "_" . $values; |
|
| 146 | + return "_".$values; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | protected function getValuesFromWhere(array $where) : string |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $this->currentBinding++; |
| 163 | 163 | |
| 164 | 164 | if ($where["type"] === "between") { |
| 165 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
| 165 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
| 166 | 166 | $this->currentBinding++; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | protected function getWhereClauses(array $wheres = []) : string |
| 174 | 174 | { |
| 175 | - return "" . $this->getWheres($wheres) |
|
| 176 | - ->reduce(function ($carry, $where) { |
|
| 175 | + return "".$this->getWheres($wheres) |
|
| 176 | + ->reduce(function($carry, $where) { |
|
| 177 | 177 | $value = $carry; |
| 178 | 178 | $value .= $this->getNestedClauses($where); |
| 179 | 179 | $value .= $this->getColumnClauses($where); |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | protected function getNestedClauses(array $where) : string |
| 189 | 189 | { |
| 190 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 190 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 191 | 191 | return ""; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
| 194 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | protected function getColumnClauses(array $where) : string |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | protected function getInAndNotInClauses(array $where) : string |
| 207 | 207 | { |
| 208 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 208 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 209 | 209 | return ""; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $result .= $glue . $value; |
|
| 242 | + $result .= $glue.$value; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | return $result; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | protected function getRawClauses(array $where) : string |
| 249 | 249 | { |
| 250 | - if (! in_array($where["type"], ["raw"])) { |
|
| 250 | + if (!in_array($where["type"], ["raw"])) { |
|
| 251 | 251 | return ""; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $clause = "_{$where["boolean"]}"; |
| 256 | 256 | |
| 257 | 257 | while (count($queryParts) > 1) { |
| 258 | - $clause .= "_" . array_shift($queryParts); |
|
| 258 | + $clause .= "_".array_shift($queryParts); |
|
| 259 | 259 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
| 260 | 260 | $this->currentBinding++; |
| 261 | 261 | } |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | $lastPart = array_shift($queryParts); |
| 264 | 264 | |
| 265 | 265 | if ($lastPart) { |
| 266 | - $clause .= "_" . $lastPart; |
|
| 266 | + $clause .= "_".$lastPart; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return "-" . str_replace(" ", "_", $clause); |
|
| 269 | + return "-".str_replace(" ", "_", $clause); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | protected function getOtherClauses(array $where) : string |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | return ""; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
| 306 | - if (! method_exists($this->model, $related)) { |
|
| 305 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
| 306 | + if (!method_exists($this->model, $related)) { |
|
| 307 | 307 | return "{$carry}-{$related}"; |
| 308 | 308 | } |
| 309 | 309 | |