@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | public function avg($column) |
| 12 | 12 | { |
| 13 | - if (! $this->isCachable()) { |
|
| 13 | + if (!$this->isCachable()) { |
|
| 14 | 14 | return parent::avg($column); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function count($columns = "*") |
| 23 | 23 | { |
| 24 | - if (! $this->isCachable()) { |
|
| 24 | + if (!$this->isCachable()) { |
|
| 25 | 25 | return parent::count($columns); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function find($id, $columns = ["*"]) |
| 53 | 53 | { |
| 54 | - if (! $this->isCachable()) { |
|
| 54 | + if (!$this->isCachable()) { |
|
| 55 | 55 | return parent::find($id, $columns); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function first($columns = ["*"]) |
| 69 | 69 | { |
| 70 | - if (! $this->isCachable()) { |
|
| 70 | + if (!$this->isCachable()) { |
|
| 71 | 71 | return parent::first($columns); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! is_array($columns)) { |
|
| 74 | + if (!is_array($columns)) { |
|
| 75 | 75 | $columns = [$columns]; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function get($columns = ["*"]) |
| 92 | 92 | { |
| 93 | - if (! $this->isCachable()) { |
|
| 93 | + if (!$this->isCachable()) { |
|
| 94 | 94 | return parent::get($columns); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public function max($column) |
| 125 | 125 | { |
| 126 | - if (! $this->isCachable()) { |
|
| 126 | + if (!$this->isCachable()) { |
|
| 127 | 127 | return parent::max($column); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | public function min($column) |
| 136 | 136 | { |
| 137 | - if (! $this->isCachable()) { |
|
| 137 | + if (!$this->isCachable()) { |
|
| 138 | 138 | return parent::min($column); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $pageName = "page", |
| 150 | 150 | $page = null |
| 151 | 151 | ) { |
| 152 | - if (! $this->isCachable()) { |
|
| 152 | + if (!$this->isCachable()) { |
|
| 153 | 153 | return parent::paginate($perPage, $columns, $pageName, $page); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | $relation = parent::getRelation($name); |
| 171 | 171 | |
| 172 | - if (! $this->isCachable() |
|
| 172 | + if (!$this->isCachable() |
|
| 173 | 173 | && is_a($relation->getQuery(), self::class) |
| 174 | 174 | ) { |
| 175 | 175 | $relation->getQuery()->disableModelCaching(); |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | foreach ($items as $key => $value) { |
| 186 | 186 | if (is_array($value)) { |
| 187 | - $result .= $key . $glue . $this->recursiveImplodeWithKey($value, $glue); |
|
| 187 | + $result .= $key.$glue.$this->recursiveImplodeWithKey($value, $glue); |
|
| 188 | 188 | |
| 189 | 189 | continue; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $result .= $glue . $key . $glue . $value; |
|
| 192 | + $result .= $glue.$key.$glue.$value; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $result; |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | public function pluck($column, $key = null) |
| 199 | 199 | { |
| 200 | - if (! $this->isCachable()) { |
|
| 200 | + if (!$this->isCachable()) { |
|
| 201 | 201 | return parent::pluck($column, $key); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
| 204 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
| 205 | 205 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
| 206 | 206 | |
| 207 | 207 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | public function sum($column) |
| 211 | 211 | { |
| 212 | - if (! $this->isCachable()) { |
|
| 212 | + if (!$this->isCachable()) { |
|
| 213 | 213 | return parent::sum($column); |
| 214 | 214 | } |
| 215 | 215 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | public function value($column) |
| 229 | 229 | { |
| 230 | - if (! $this->isCachable()) { |
|
| 230 | + if (!$this->isCachable()) { |
|
| 231 | 231 | return parent::value($column); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | return $this->cache($cacheTags) |
| 307 | 307 | ->rememberForever( |
| 308 | 308 | $hashedCacheKey, |
| 309 | - function () use ($arguments, $cacheKey, $method) { |
|
| 309 | + function() use ($arguments, $cacheKey, $method) { |
|
| 310 | 310 | return [ |
| 311 | 311 | "key" => $cacheKey, |
| 312 | 312 | "value" => parent::{$method}(...$arguments), |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function getLimitClause() : string |
| 56 | 56 | { |
| 57 | - if (! property_exists($this->query, "limit") |
|
| 58 | - || ! $this->query->limit |
|
| 57 | + if (!property_exists($this->query, "limit") |
|
| 58 | + || !$this->query->limit |
|
| 59 | 59 | ) { |
| 60 | 60 | return ""; |
| 61 | 61 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | protected function getOffsetClause() : string |
| 78 | 78 | { |
| 79 | - if (! property_exists($this->query, "offset") |
|
| 80 | - || ! $this->query->offset |
|
| 79 | + if (!property_exists($this->query, "offset") |
|
| 80 | + || !$this->query->offset |
|
| 81 | 81 | ) { |
| 82 | 82 | return ""; |
| 83 | 83 | } |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | protected function getOrderByClauses() : string |
| 89 | 89 | { |
| 90 | - if (! property_exists($this->query, "orders") |
|
| 91 | - || ! $this->query->orders |
|
| 90 | + if (!property_exists($this->query, "orders") |
|
| 91 | + || !$this->query->orders |
|
| 92 | 92 | ) { |
| 93 | 93 | return ""; |
| 94 | 94 | } |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | $orders = collect($this->query->orders); |
| 97 | 97 | |
| 98 | 98 | return $orders |
| 99 | - ->reduce(function ($carry, $order) { |
|
| 99 | + ->reduce(function($carry, $order) { |
|
| 100 | 100 | if (($order["type"] ?? "") === "Raw") { |
| 101 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
| 101 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
| 104 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
| 105 | 105 | }) |
| 106 | 106 | ?: ""; |
| 107 | 107 | } |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | if (($columns === ["*"] |
| 112 | 112 | || $columns === []) |
| 113 | - && (! property_exists($this->query, "columns") |
|
| 114 | - || ! $this->query->columns) |
|
| 113 | + && (!property_exists($this->query, "columns") |
|
| 114 | + || !$this->query->columns) |
|
| 115 | 115 | ) { |
| 116 | 116 | return ""; |
| 117 | 117 | } |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | if (property_exists($this->query, "columns") |
| 120 | 120 | && $this->query->columns |
| 121 | 121 | ) { |
| 122 | - return "_" . implode("_", $this->query->columns); |
|
| 122 | + return "_".implode("_", $this->query->columns); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return "_" . implode("_", $columns); |
|
| 125 | + return "_".implode("_", $columns); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | protected function getTypeClause($where) : string |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | protected function getValuesClause(array $where = []) : string |
| 138 | 138 | { |
| 139 | - if (! $where |
|
| 139 | + if (!$where |
|
| 140 | 140 | || in_array($where["type"], ["NotNull", "Null"]) |
| 141 | 141 | ) { |
| 142 | 142 | return ""; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $values = $this->getValuesFromWhere($where); |
| 146 | 146 | $values = $this->getValuesFromBindings($where, $values); |
| 147 | 147 | |
| 148 | - return "_" . $values; |
|
| 148 | + return "_".$values; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | protected function getValuesFromWhere(array $where) : string |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $subKey = str_replace($prefix, "", $subKey); |
| 158 | 158 | $subKey = str_replace($this->getModelSlug(), "", $subKey); |
| 159 | 159 | $classParts = explode("\\", get_class($this->model)); |
| 160 | - $subKey = strtolower(array_pop($classParts)) . $subKey; |
|
| 160 | + $subKey = strtolower(array_pop($classParts)).$subKey; |
|
| 161 | 161 | |
| 162 | 162 | return $subKey; |
| 163 | 163 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $this->currentBinding++; |
| 177 | 177 | |
| 178 | 178 | if ($where["type"] === "between") { |
| 179 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
| 179 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
| 180 | 180 | $this->currentBinding++; |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | protected function getWhereClauses(array $wheres = []) : string |
| 188 | 188 | { |
| 189 | - return "" . $this->getWheres($wheres) |
|
| 190 | - ->reduce(function ($carry, $where) { |
|
| 189 | + return "".$this->getWheres($wheres) |
|
| 190 | + ->reduce(function($carry, $where) { |
|
| 191 | 191 | $value = $carry; |
| 192 | 192 | $value .= $this->getNestedClauses($where); |
| 193 | 193 | $value .= $this->getColumnClauses($where); |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | protected function getNestedClauses(array $where) : string |
| 203 | 203 | { |
| 204 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 204 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 205 | 205 | return ""; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
| 208 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | protected function getColumnClauses(array $where) : string |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | protected function getInClauses(array $where) : string |
| 221 | 221 | { |
| 222 | - if (! in_array($where["type"], ["In"])) { |
|
| 222 | + if (!in_array($where["type"], ["In"])) { |
|
| 223 | 223 | return ""; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -231,7 +231,7 @@ discard block |
||
| 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 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | continue; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - $result .= $glue . $value; |
|
| 272 | + $result .= $glue.$value; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return $result; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | protected function getRawClauses(array $where) : string |
| 279 | 279 | { |
| 280 | - if (! in_array($where["type"], ["raw"])) { |
|
| 280 | + if (!in_array($where["type"], ["raw"])) { |
|
| 281 | 281 | return ""; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $clause = "_{$where["boolean"]}"; |
| 286 | 286 | |
| 287 | 287 | while (count($queryParts) > 1) { |
| 288 | - $clause .= "_" . array_shift($queryParts); |
|
| 288 | + $clause .= "_".array_shift($queryParts); |
|
| 289 | 289 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
| 290 | 290 | $this->currentBinding++; |
| 291 | 291 | } |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | $lastPart = array_shift($queryParts); |
| 294 | 294 | |
| 295 | 295 | if ($lastPart) { |
| 296 | - $clause .= "_" . $lastPart; |
|
| 296 | + $clause .= "_".$lastPart; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - return "-" . str_replace(" ", "_", $clause); |
|
| 299 | + return "-".str_replace(" ", "_", $clause); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | protected function getOtherClauses(array $where) : string |
@@ -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 | |