@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | protected function getLimitClause() : string |
56 | 56 | { |
57 | - if (! $this->query->limit) { |
|
57 | + if (!$this->query->limit) { |
|
58 | 58 | return ""; |
59 | 59 | } |
60 | 60 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function getOffsetClause() : string |
76 | 76 | { |
77 | - if (! $this->query->offset) { |
|
77 | + if (!$this->query->offset) { |
|
78 | 78 | return ""; |
79 | 79 | } |
80 | 80 | |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $orders = collect($this->query->orders); |
87 | 87 | |
88 | 88 | return $orders |
89 | - ->reduce(function ($carry, $order) { |
|
89 | + ->reduce(function($carry, $order) { |
|
90 | 90 | if (($order["type"] ?? "") === "Raw") { |
91 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
91 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
92 | 92 | } |
93 | 93 | |
94 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
94 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
95 | 95 | }) |
96 | 96 | ?: ""; |
97 | 97 | } |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | { |
101 | 101 | if (($columns === ["*"] |
102 | 102 | || $columns === []) |
103 | - && ! $this->query->columns |
|
103 | + && !$this->query->columns |
|
104 | 104 | ) { |
105 | 105 | return ""; |
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($this->query->columns) { |
109 | - return "_" . implode("_", $this->query->columns); |
|
109 | + return "_".implode("_", $this->query->columns); |
|
110 | 110 | } |
111 | 111 | |
112 | - return "_" . implode("_", $columns); |
|
112 | + return "_".implode("_", $columns); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | protected function getTypeClause($where) : string |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | protected function getValuesClause(array $where = []) : string |
125 | 125 | { |
126 | - if (! $where |
|
126 | + if (!$where |
|
127 | 127 | || in_array($where["type"], ["NotNull", "Null"]) |
128 | 128 | ) { |
129 | 129 | return ""; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $values = $this->getValuesFromWhere($where); |
133 | 133 | $values = $this->getValuesFromBindings($where, $values); |
134 | 134 | |
135 | - return "_" . $values; |
|
135 | + return "_".$values; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function getValuesFromWhere(array $where) : string |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $subKey = str_replace($prefix, "", $subKey); |
145 | 145 | $subKey = str_replace($this->getModelSlug(), "", $subKey); |
146 | 146 | $classParts = explode("\\", get_class($this->model)); |
147 | - $subKey = strtolower(array_pop($classParts)) . $subKey; |
|
147 | + $subKey = strtolower(array_pop($classParts)).$subKey; |
|
148 | 148 | |
149 | 149 | return $subKey; |
150 | 150 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $this->currentBinding++; |
164 | 164 | |
165 | 165 | if ($where["type"] === "between") { |
166 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
166 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
167 | 167 | $this->currentBinding++; |
168 | 168 | } |
169 | 169 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | |
174 | 174 | protected function getWhereClauses(array $wheres = []) : string |
175 | 175 | { |
176 | - return "" . $this->getWheres($wheres) |
|
177 | - ->reduce(function ($carry, $where) { |
|
176 | + return "".$this->getWheres($wheres) |
|
177 | + ->reduce(function($carry, $where) { |
|
178 | 178 | $value = $carry; |
179 | 179 | $value .= $this->getNestedClauses($where); |
180 | 180 | $value .= $this->getColumnClauses($where); |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | |
189 | 189 | protected function getNestedClauses(array $where) : string |
190 | 190 | { |
191 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
191 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
192 | 192 | return ""; |
193 | 193 | } |
194 | 194 | |
195 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
195 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | protected function getColumnClauses(array $where) : string |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | protected function getInClauses(array $where) : string |
208 | 208 | { |
209 | - if (! in_array($where["type"], ["In"])) { |
|
209 | + if (!in_array($where["type"], ["In"])) { |
|
210 | 210 | return ""; |
211 | 211 | } |
212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | protected function getInAndNotInClauses(array $where) : string |
220 | 220 | { |
221 | - if (! in_array($where["type"], ["In", "NotIn"])) { |
|
221 | + if (!in_array($where["type"], ["In", "NotIn"])) { |
|
222 | 222 | return ""; |
223 | 223 | } |
224 | 224 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | - $result .= $glue . $value; |
|
259 | + $result .= $glue.$value; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $result; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $clause = "_{$where["boolean"]}"; |
273 | 273 | |
274 | 274 | while (count($queryParts) > 1) { |
275 | - $clause .= "_" . array_shift($queryParts); |
|
275 | + $clause .= "_".array_shift($queryParts); |
|
276 | 276 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
277 | 277 | $this->currentBinding++; |
278 | 278 | } |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | $lastPart = array_shift($queryParts); |
281 | 281 | |
282 | 282 | if ($lastPart) { |
283 | - $clause .= "_" . $lastPart; |
|
283 | + $clause .= "_".$lastPart; |
|
284 | 284 | } |
285 | 285 | |
286 | - return "-" . str_replace(" ", "_", $clause); |
|
286 | + return "-".str_replace(" ", "_", $clause); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | protected function getOtherClauses(array $where) : string |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | return ""; |
318 | 318 | } |
319 | 319 | |
320 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
321 | - if (! method_exists($this->model, $related)) { |
|
320 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
321 | + if (!method_exists($this->model, $related)) { |
|
322 | 322 | return "{$carry}-{$related}"; |
323 | 323 | } |
324 | 324 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function avg($column) |
17 | 17 | { |
18 | - if (! $this->isCachable()) { |
|
18 | + if (!$this->isCachable()) { |
|
19 | 19 | return parent::avg($column); |
20 | 20 | } |
21 | 21 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function count($columns = "*") |
28 | 28 | { |
29 | - if (! $this->isCachable()) { |
|
29 | + if (!$this->isCachable()) { |
|
30 | 30 | return parent::count($columns); |
31 | 31 | } |
32 | 32 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function find($id, $columns = ["*"]) |
58 | 58 | { |
59 | - if (! $this->isCachable()) { |
|
59 | + if (!$this->isCachable()) { |
|
60 | 60 | return parent::find($id, $columns); |
61 | 61 | } |
62 | 62 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | public function first($columns = ["*"]) |
74 | 74 | { |
75 | - if (! $this->isCachable()) { |
|
75 | + if (!$this->isCachable()) { |
|
76 | 76 | return parent::first($columns); |
77 | 77 | } |
78 | 78 | |
79 | - if (! is_array($columns)) { |
|
79 | + if (!is_array($columns)) { |
|
80 | 80 | $columns = [$columns]; |
81 | 81 | } |
82 | 82 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | public function get($columns = ["*"]) |
97 | 97 | { |
98 | - if (! $this->isCachable()) { |
|
98 | + if (!$this->isCachable()) { |
|
99 | 99 | return parent::get($columns); |
100 | 100 | } |
101 | 101 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | public function max($column) |
130 | 130 | { |
131 | - if (! $this->isCachable()) { |
|
131 | + if (!$this->isCachable()) { |
|
132 | 132 | return parent::max($column); |
133 | 133 | } |
134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | public function min($column) |
141 | 141 | { |
142 | - if (! $this->isCachable()) { |
|
142 | + if (!$this->isCachable()) { |
|
143 | 143 | return parent::min($column); |
144 | 144 | } |
145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $pageName = "page", |
155 | 155 | $page = null |
156 | 156 | ) { |
157 | - if (! $this->isCachable()) { |
|
157 | + if (!$this->isCachable()) { |
|
158 | 158 | return parent::paginate($perPage, $columns, $pageName, $page); |
159 | 159 | } |
160 | 160 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | $relation = parent::getRelation($name); |
176 | 176 | |
177 | - if (! $this->isCachable() |
|
177 | + if (!$this->isCachable() |
|
178 | 178 | && is_a($relation->getQuery(), self::class) |
179 | 179 | ) { |
180 | 180 | $relation->getQuery()->disableModelCaching(); |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | foreach ($items as $key => $value) { |
191 | 191 | if (is_array($value)) { |
192 | - $result .= $key . $glue . $this->recursiveImplodeWithKey($value, $glue); |
|
192 | + $result .= $key.$glue.$this->recursiveImplodeWithKey($value, $glue); |
|
193 | 193 | |
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | |
197 | - $result .= $glue . $key . $glue . $value; |
|
197 | + $result .= $glue.$key.$glue.$value; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | return $result; |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | |
203 | 203 | public function pluck($column, $key = null) |
204 | 204 | { |
205 | - if (! $this->isCachable()) { |
|
205 | + if (!$this->isCachable()) { |
|
206 | 206 | return parent::pluck($column, $key); |
207 | 207 | } |
208 | 208 | |
209 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
209 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
210 | 210 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
211 | 211 | |
212 | 212 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | public function sum($column) |
216 | 216 | { |
217 | - if (! $this->isCachable()) { |
|
217 | + if (!$this->isCachable()) { |
|
218 | 218 | return parent::sum($column); |
219 | 219 | } |
220 | 220 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function value($column) |
234 | 234 | { |
235 | - if (! $this->isCachable()) { |
|
235 | + if (!$this->isCachable()) { |
|
236 | 236 | return parent::value($column); |
237 | 237 | } |
238 | 238 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | return $this->cache($cacheTags) |
302 | 302 | ->rememberForever( |
303 | 303 | $hashedCacheKey, |
304 | - function () use ($arguments, $cacheKey, $method) { |
|
304 | + function() use ($arguments, $cacheKey, $method) { |
|
305 | 305 | return [ |
306 | 306 | "key" => $cacheKey, |
307 | 307 | "value" => parent::{$method}(...$arguments), |