We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -75,7 +75,7 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | // relationships are always public methods. |
78 | - if (! $methodReflection->isPublic()) { |
|
78 | + if (!$methodReflection->isPublic()) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | return $this->attributes->getItems(); |
32 | 32 | } |
33 | 33 | |
34 | - public static function make(string|array|Collection $name, CollectionRepository $collectionRepository): SmartComponentInterface |
|
34 | + public static function make(string | array | Collection $name, CollectionRepository $collectionRepository): SmartComponentInterface |
|
35 | 35 | { |
36 | 36 | $attributes = new AttributeCollection($name, $collectionRepository); |
37 | 37 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function __call($name, $arguments) |
72 | 72 | { |
73 | - if (! method_exists($this, $name)) { |
|
73 | + if (!method_exists($this, $name)) { |
|
74 | 74 | if ($this->isAttributeBlocked($name)) { |
75 | 75 | throw new \Exception("Attribute {$name} cannot be changed in this component."); |
76 | 76 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public function __construct(private array $defaults) |
10 | 10 | { |
11 | 11 | dump($defaults); |
12 | - $this->defaults = collect($defaults)->mapWithKeys(function ($default, $attribute) { |
|
12 | + $this->defaults = collect($defaults)->mapWithKeys(function($default, $attribute) { |
|
13 | 13 | if (is_a($default, AttributeInterface::class, true)) { |
14 | 14 | return [$default::getAttributeName() => $default]; |
15 | 15 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return $this->defaults; |
24 | 24 | } |
25 | 25 | |
26 | - public function for($attribute) |
|
26 | + public function for ($attribute) |
|
27 | 27 | { |
28 | 28 | return $this->defaults[$attribute] ?? []; |
29 | 29 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public function __construct(private array $rules) |
10 | 10 | { |
11 | - $this->rules = collect($rules)->mapWithKeys(function ($rule, $attribute) { |
|
11 | + $this->rules = collect($rules)->mapWithKeys(function($rule, $attribute) { |
|
12 | 12 | if (is_a($rule, AttributeInterface::class, true)) { |
13 | 13 | return [$rule::getAttributeName() => $rule::getValidationRules()]; |
14 | 14 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | return $this->rules; |
23 | 23 | } |
24 | 24 | |
25 | - public function for($attribute) |
|
25 | + public function for ($attribute) |
|
26 | 26 | { |
27 | 27 | return $this->rules[$attribute] ?? []; |
28 | 28 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | 'model' => [ |
26 | 26 | 'required', |
27 | 27 | 'string', |
28 | - function ($attribute, $value, $fail) { |
|
29 | - if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
|
28 | + function($attribute, $value, $fail) { |
|
29 | + if (!is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
|
30 | 30 | $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .'); |
31 | 31 | } |
32 | 32 | }, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | return [ |
43 | 43 | EntityAttribute::class, |
44 | - 'model' => function ($attributes) { |
|
44 | + 'model' => function($attributes) { |
|
45 | 45 | return app('BSL')->inferComponentModelFromRelationship($attributes->getAttributes()); |
46 | 46 | }, |
47 | 47 | ]; |
@@ -22,17 +22,17 @@ |
||
22 | 22 | return app('crud'); |
23 | 23 | } |
24 | 24 | |
25 | - public static function button(string|array $name) |
|
25 | + public static function button(string | array $name) |
|
26 | 26 | { |
27 | 27 | } |
28 | 28 | |
29 | - public static function field(string|array|SmartComponentInterface $input) |
|
29 | + public static function field(string | array | SmartComponentInterface $input) |
|
30 | 30 | { |
31 | 31 | $fieldRepository = new CollectionRepository( |
32 | - function () { |
|
32 | + function() { |
|
33 | 33 | return self::page()->getOperationSetting('fields') ?? collect(); |
34 | 34 | }, |
35 | - function ($collection) { |
|
35 | + function($collection) { |
|
36 | 36 | return self::page()->setOperationSetting('fields', $collection); |
37 | 37 | } |
38 | 38 | ); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $items = $this->getItems(); |
18 | 18 | $items[$key] = $value; |
19 | - ! $save ?: $this->save($items->toArray()); |
|
19 | + !$save ?: $this->save($items->toArray()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function getItems(): Collection |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | |
31 | 31 | public function removeItem($attribute, $save = true) |
32 | 32 | { |
33 | - $items = $this->getItems()->filter(function ($collectionItem, $key) use ($attribute) { |
|
33 | + $items = $this->getItems()->filter(function($collectionItem, $key) use ($attribute) { |
|
34 | 34 | return $collectionItem->getName() !== $attribute; |
35 | 35 | }); |
36 | 36 | |
37 | - ! $save ?: $this->save($items); |
|
37 | + !$save ?: $this->save($items); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | private function save($collection) |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function getItemByName($name) |
53 | 53 | { |
54 | - return $this->getItems()->first(function ($item, $key) use ($name) { |
|
54 | + return $this->getItems()->first(function($item, $key) use ($name) { |
|
55 | 55 | return $key === $name; |
56 | 56 | }); |
57 | 57 | } |
@@ -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 BackpackAttribute($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|BackpackAttribute $item) |
|
120 | + private function updateItem(AttributeInterface | BackpackAttribute $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 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function attributes(): Collection; |
22 | 22 | |
23 | - public static function make(string|array|Collection $name, CollectionRepository $collectionRepository): SmartComponentInterface; |
|
23 | + public static function make(string | array | Collection $name, CollectionRepository $collectionRepository): SmartComponentInterface; |
|
24 | 24 | |
25 | 25 | public static function makeOf(AttributeCollection $attributes); |
26 | 26 |