We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | protected Collection $items; |
| 14 | 14 | |
| 15 | - public function __construct(array|string|Collection $attributes, |
|
| 15 | + public function __construct(array | string | Collection $attributes, |
|
| 16 | 16 | private CollectionRepository $collectionRepository, |
| 17 | - ValidationRules|array $rules = [], |
|
| 17 | + ValidationRules | array $rules = [], |
|
| 18 | 18 | array $defaults = [] |
| 19 | 19 | ) { |
| 20 | 20 | $attributes = is_string($attributes) ? collect(['name' => $attributes]) : collect($attributes); |
| 21 | 21 | $rules = is_array($rules) ? new ValidationRules($rules) : $rules; |
| 22 | 22 | |
| 23 | - $defaults = collect($defaults)->mapWithKeys(function ($default, $attribute) { |
|
| 23 | + $defaults = collect($defaults)->mapWithKeys(function($default, $attribute) { |
|
| 24 | 24 | if (is_a($default, AttributeInterface::class, true)) { |
| 25 | 25 | return [$default::getAttributeName() => $default]; |
| 26 | 26 | } |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | private function buildAttributes(Collection $attributes, ValidationRules $rules, array $defaults): Collection |
| 38 | 38 | { |
| 39 | - return $attributes->mapWithKeys(function ($attribute, $key) use ($rules, $defaults) { |
|
| 40 | - if (! is_a($attribute, AttributeInterface::class, true)) { |
|
| 39 | + return $attributes->mapWithKeys(function($attribute, $key) use ($rules, $defaults) { |
|
| 40 | + if (!is_a($attribute, AttributeInterface::class, true)) { |
|
| 41 | 41 | return [$key => new BaseAttribute($key, $attribute, $defaults[$key] ?? null, $rules->for($key))]; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $rules = new ValidationRules($rules); |
| 78 | 78 | |
| 79 | - $this->items->each(function ($item, $key) use ($rules) { |
|
| 80 | - if (! is_string($key) && is_a($item, AttributeInterface::class, true)) { |
|
| 79 | + $this->items->each(function($item, $key) use ($rules) { |
|
| 80 | + if (!is_string($key) && is_a($item, AttributeInterface::class, true)) { |
|
| 81 | 81 | $key = $item::getAttributeName(); |
| 82 | 82 | } |
| 83 | 83 | if (is_string($rules->for($key) ?? [])) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $this->collectionRepository->addItem($item->getAttribute('name'), $item->getAttributesArray()); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - private function updateItem(AttributeInterface|BaseAttribute $item) |
|
| 120 | + private function updateItem(AttributeInterface | BaseAttribute $item) |
|
| 121 | 121 | { |
| 122 | 122 | $this->items[$item->attribute] = $item; |
| 123 | 123 | $this->collectionRepository->setItemAttributes($this->getAttributeValue('name'), $this->toArray()); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | public function toArray() |
| 133 | 133 | { |
| 134 | - return $this->items->mapWithKeys(function ($item, $key) { |
|
| 134 | + return $this->items->mapWithKeys(function($item, $key) { |
|
| 135 | 135 | return [$key => $item->value()]; |
| 136 | 136 | })->toArray(); |
| 137 | 137 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | public function setAttributeDefaults(array $defaults) |
| 140 | 140 | { |
| 141 | 141 | foreach ($defaults as $key => $default) { |
| 142 | - if (! is_string($key) && is_a($default, AttributeInterface::class, true)) { |
|
| 142 | + if (!is_string($key) && is_a($default, AttributeInterface::class, true)) { |
|
| 143 | 143 | $key = $default::getAttributeName(); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! $this->items->has($key)) { |
|
| 146 | + if (!$this->items->has($key)) { |
|
| 147 | 147 | if (is_a($default, AttributeInterface::class, true)) { |
| 148 | 148 | $this->items[$key] = $default::make($key, $default::getDefault($this), $default, []); |
| 149 | 149 | |