@@ -71,9 +71,9 @@ |
||
71 | 71 | $instance = new static; |
72 | 72 | |
73 | 73 | $instance->setConnection($parent->getConnectionName()) |
74 | - ->setTable($table) |
|
75 | - ->fill($attributes) |
|
76 | - ->syncOriginal(); |
|
74 | + ->setTable($table) |
|
75 | + ->fill($attributes) |
|
76 | + ->syncOriginal(); |
|
77 | 77 | |
78 | 78 | $instance->pivotParent = $parent; |
79 | 79 |
@@ -142,7 +142,7 @@ |
||
142 | 142 | return 0; |
143 | 143 | } |
144 | 144 | |
145 | - return take($this->getDeleteQuery()->delete(), function () { |
|
145 | + return take($this->getDeleteQuery()->delete(), function() { |
|
146 | 146 | $this->exists = false; |
147 | 147 | |
148 | 148 | $this->fireModelEvent('deleted', false); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | protected function formatSyncList(array $records): array |
75 | 75 | { |
76 | - return collect($records)->mapKeys(function ($attributes, $id) { |
|
76 | + return collect($records)->mapKeys(function($attributes, $id) { |
|
77 | 77 | if ( ! is_array($attributes)) { |
78 | 78 | list($id, $attributes) = [$attributes, []]; |
79 | 79 | } |
@@ -220,7 +220,9 @@ |
||
220 | 220 | if ( ! is_null($ids)) { |
221 | 221 | $ids = $this->parseWithIds($ids); |
222 | 222 | |
223 | - if (empty($ids)) return 0; |
|
223 | + if (empty($ids)) { |
|
224 | + return 0; |
|
225 | + } |
|
224 | 226 | |
225 | 227 | $query->whereIn($this->relatedKey, $ids); |
226 | 228 | } |
@@ -179,10 +179,10 @@ |
||
179 | 179 | protected function getKeys(array $models, $key = null): array |
180 | 180 | { |
181 | 181 | return collect($models)->map(fn ($value) => $key ? $value->getAttribute($key) : $value->getKey()) |
182 | - ->values() |
|
183 | - ->unique(null, true) |
|
184 | - ->sort() |
|
185 | - ->all(); |
|
182 | + ->values() |
|
183 | + ->unique(null, true) |
|
184 | + ->sort() |
|
185 | + ->all(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -143,7 +143,7 @@ |
||
143 | 143 | |
144 | 144 | foreach ($models as $model) { |
145 | 145 | if ( ! is_null($value = $model->{$this->foreignKey})) { |
146 | - $keys[]= $value; |
|
146 | + $keys[] = $value; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $defaults = [$this->foreignPivotKey, $this->relatedKey]; |
246 | 246 | |
247 | - return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { |
|
247 | + return collect(array_merge($defaults, $this->pivotColumns))->map(function($column) { |
|
248 | 248 | return $this->qualifyPivotColumn($column).' as pivot_'.$column; |
249 | 249 | })->unique()->all(); |
250 | 250 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @return static |
559 | 559 | */ |
560 | - public function wherePivotNull($column, $boolean = 'and', $negative = false): static |
|
560 | + public function wherePivotNull($column, $boolean = 'and', $negative = false): static |
|
561 | 561 | { |
562 | 562 | $this->pivotWhereNulls[] = func_get_args(); |
563 | 563 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | if (count($result) === count(array_unique($id))) { |
748 | 748 | return $result; |
749 | 749 | } |
750 | - } elseif (! is_null($result)) { |
|
750 | + } elseif ( ! is_null($result)) { |
|
751 | 751 | return $result; |
752 | 752 | } |
753 | 753 |
@@ -585,8 +585,8 @@ |
||
585 | 585 | protected function buildNotInstantiable(string $class): mixed |
586 | 586 | { |
587 | 587 | if ( ! empty($this->buildStack)) { |
588 | - $reset = implode(', ', $this->buildStack); |
|
589 | - $message = "Target [{$class}] is not instantiable while building [{$reset}]"; |
|
588 | + $reset = implode(', ', $this->buildStack); |
|
589 | + $message = "Target [{$class}] is not instantiable while building [{$reset}]"; |
|
590 | 590 | } else { |
591 | 591 | $message = "Target [{$class}] is not instantiable"; |
592 | 592 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return void |
212 | 212 | */ |
213 | - public function bind($id, Closure|string $value = null, bool $singleton = false): void |
|
213 | + public function bind($id, Closure | string $value = null, bool $singleton = false): void |
|
214 | 214 | { |
215 | 215 | $this->dropInstances($id); |
216 | 216 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected function getClosure($id, string $value): mixed |
257 | 257 | { |
258 | - return function ($container, $parameters = []) use ($id, $value) { |
|
258 | + return function($container, $parameters = []) use ($id, $value) { |
|
259 | 259 | if ($id == $value) { |
260 | 260 | return $container->build($value); |
261 | 261 | } |
@@ -173,7 +173,9 @@ |
||
173 | 173 | { |
174 | 174 | $this->hasCallbacks[$id = $this->getAlias($id)][] = $callback; |
175 | 175 | |
176 | - if ($this->bound($id)) return $this->make($id); |
|
176 | + if ($this->bound($id)) { |
|
177 | + return $this->make($id); |
|
178 | + } |
|
177 | 179 | } |
178 | 180 | |
179 | 181 | /** |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @return string|null |
52 | 52 | */ |
53 | - public static function getParameterClassName($parameter): string|null |
|
53 | + public static function getParameterClassName($parameter): string | null |
|
54 | 54 | { |
55 | 55 | $type = $parameter->getType(); |
56 | 56 |
@@ -168,61 +168,61 @@ |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - * Magic method. |
|
171 | + * Magic method. |
|
172 | 172 | * |
173 | 173 | * Searches for the given variable and returns its value. |
174 | - * |
|
175 | - * @param string $key Variable name |
|
176 | - * |
|
177 | - * @return mixed |
|
178 | - */ |
|
179 | - public function __get($key) |
|
180 | - { |
|
181 | - return $this->get($key); |
|
182 | - } |
|
183 | - |
|
184 | - /** |
|
185 | - * Magic method. |
|
174 | + * |
|
175 | + * @param string $key Variable name |
|
176 | + * |
|
177 | + * @return mixed |
|
178 | + */ |
|
179 | + public function __get($key) |
|
180 | + { |
|
181 | + return $this->get($key); |
|
182 | + } |
|
183 | + |
|
184 | + /** |
|
185 | + * Magic method. |
|
186 | 186 | * |
187 | 187 | * Calls [$this->set] with the same parameters. |
188 | - * |
|
189 | - * @param string $key Variable name |
|
190 | - * @param mixed $value Value |
|
191 | - * |
|
192 | - * @return void |
|
193 | - */ |
|
194 | - public function __set($key, $value) |
|
195 | - { |
|
196 | - $this->offsetSet($key, $value); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Magic method. |
|
188 | + * |
|
189 | + * @param string $key Variable name |
|
190 | + * @param mixed $value Value |
|
191 | + * |
|
192 | + * @return void |
|
193 | + */ |
|
194 | + public function __set($key, $value) |
|
195 | + { |
|
196 | + $this->offsetSet($key, $value); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Magic method. |
|
201 | 201 | * |
202 | 202 | * Determines if a variable is set. |
203 | - * |
|
204 | - * @param string $key variable name |
|
205 | - * |
|
206 | - * @return boolean |
|
207 | - */ |
|
208 | - public function __isset($key) |
|
209 | - { |
|
210 | - return $this->offsetExists($key); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Magic method. |
|
203 | + * |
|
204 | + * @param string $key variable name |
|
205 | + * |
|
206 | + * @return boolean |
|
207 | + */ |
|
208 | + public function __isset($key) |
|
209 | + { |
|
210 | + return $this->offsetExists($key); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * Magic method. |
|
215 | 215 | * |
216 | 216 | * Unsets a given variable. |
217 | - * |
|
218 | - * @param string $key Variable name |
|
219 | - * |
|
220 | - * @return void |
|
221 | - */ |
|
222 | - public function __unset($key) |
|
223 | - { |
|
224 | - $this->offsetUnset($$key); |
|
225 | - } |
|
217 | + * |
|
218 | + * @param string $key Variable name |
|
219 | + * |
|
220 | + * @return void |
|
221 | + */ |
|
222 | + public function __unset($key) |
|
223 | + { |
|
224 | + $this->offsetUnset($$key); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Magic method. |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function replace($replaceMap, $keepMap, $rules): Closure |
73 | 73 | { |
74 | - return function ($word) use ($replaceMap, $keepMap, $rules) { |
|
74 | + return function($word) use ($replaceMap, $keepMap, $rules) { |
|
75 | 75 | $token = strtolower($word); |
76 | 76 | |
77 | 77 | if (array_key_exists($token, $keepMap)) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function checkWord($replaceMap, $keepMap, $rules): Closure |
99 | 99 | { |
100 | - return function ($word) use ($replaceMap, $keepMap, $rules) { |
|
100 | + return function($word) use ($replaceMap, $keepMap, $rules) { |
|
101 | 101 | $token = strtolower($word); |
102 | 102 | |
103 | 103 | if (array_key_exists($token, $keepMap)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function replaceWord($word, $rule): string |
124 | 124 | { |
125 | - return preg_replace_callback($rule[0], function ($matches) use ($word, $rule) { |
|
125 | + return preg_replace_callback($rule[0], function($matches) use ($word, $rule) { |
|
126 | 126 | if ( ! isset($matches[0])) { |
127 | 127 | return $word; |
128 | 128 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function interpolate($str, $args) |
150 | 150 | { |
151 | - return preg_replace_callback('/\$(\d{1,2})/', function ($matches) use ($args) { |
|
151 | + return preg_replace_callback('/\$(\d{1,2})/', function($matches) use ($args) { |
|
152 | 152 | return isset($matches[1], $args[$matches[1]]) |
153 | 153 | ? $args[$matches[1]] |
154 | 154 | : ""; |