@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Fields\Types; |
6 | 6 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function optional(): bool |
80 | 80 | { |
81 | - return ! $this->required(); |
|
81 | + return !$this->required(); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function name(string $name = null) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $value = call_user_func_array($this->valueResolver, [$model, $locale]); |
145 | 145 | |
146 | - if(is_null($value)) return $this->default; |
|
146 | + if (is_null($value)) return $this->default; |
|
147 | 147 | |
148 | 148 | return $value; |
149 | 149 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | private function defaultValueResolver(): callable |
159 | 159 | { |
160 | - return function (Model $model, $locale) { |
|
160 | + return function(Model $model, $locale) { |
|
161 | 161 | if ($this->isTranslatable() && $locale) { |
162 | 162 | return $model->getTranslationFor($this->column(), $locale); |
163 | 163 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | if (!in_array($name, ['label', 'key', 'description', 'column', 'name', 'prepend', 'append'])) { |
235 | - throw new \InvalidArgumentException('Cannot set value by ['. $name .'].'); |
|
235 | + throw new \InvalidArgumentException('Cannot set value by ['.$name.'].'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $this->values[$name] = $arguments[0]; |
@@ -143,7 +143,9 @@ |
||
143 | 143 | { |
144 | 144 | $value = call_user_func_array($this->valueResolver, [$model, $locale]); |
145 | 145 | |
146 | - if(is_null($value)) return $this->default; |
|
146 | + if(is_null($value)) { |
|
147 | + return $this->default; |
|
148 | + } |
|
147 | 149 | |
148 | 150 | return $value; |
149 | 151 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return $this->indexPagination($builder); |
85 | 85 | } |
86 | 86 | |
87 | - return $builder->get()->map(function ($model) { |
|
87 | + return $builder->get()->map(function($model) { |
|
88 | 88 | return (new static($this->registration))->manage($model); |
89 | 89 | }); |
90 | 90 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $paginator = $builder->paginate($this->pageCount); |
114 | 114 | |
115 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
115 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
116 | 116 | return (new static($this->registration))->manage($model); |
117 | 117 | }); |
118 | 118 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function can($verb): bool |
179 | 179 | { |
180 | 180 | foreach (static::$bootedTraitMethods['can'] as $method) { |
181 | - if(!method_exists($this, $method)) continue; |
|
181 | + if (!method_exists($this, $method)) continue; |
|
182 | 182 | $this->$method($verb); |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | public function guard($verb): Manager |
189 | 189 | { |
190 | - if (! $this->can($verb)) { |
|
190 | + if (!$this->can($verb)) { |
|
191 | 191 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
192 | 192 | } |
193 | 193 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $fields = $this->fields(); |
211 | 211 | |
212 | 212 | foreach ($this->assistants() as $assistant) { |
213 | - if (! method_exists($assistant, 'fields')) { |
|
213 | + if (!method_exists($assistant, 'fields')) { |
|
214 | 214 | continue; |
215 | 215 | } |
216 | 216 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | static::$bootedTraitMethods[$baseMethod] = []; |
293 | 293 | |
294 | 294 | foreach (class_uses_recursive($class) as $trait) { |
295 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
295 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
296 | 296 | |
297 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
297 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
298 | 298 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
299 | 299 | } |
300 | 300 | } |
@@ -178,7 +178,9 @@ |
||
178 | 178 | public function can($verb): bool |
179 | 179 | { |
180 | 180 | foreach (static::$bootedTraitMethods['can'] as $method) { |
181 | - if(!method_exists($this, $method)) continue; |
|
181 | + if(!method_exists($this, $method)) { |
|
182 | + continue; |
|
183 | + } |
|
182 | 184 | $this->$method($verb); |
183 | 185 | } |
184 | 186 |