We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class BaseField extends BaseComponent |
22 | 22 | { |
23 | - public function __construct(string|array $attributes) |
|
23 | + public function __construct(string | array $attributes) |
|
24 | 24 | { |
25 | 25 | $collection = new FieldCollection($attributes, static::attributes(), static::rules(), static::defaults(), static::blocked()); |
26 | 26 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
47 | - public static function make(string|array $attributes): self |
|
47 | + public static function make(string | array $attributes): self |
|
48 | 48 | { |
49 | 49 | return new static($attributes); |
50 | 50 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | private Collection $attributes; |
14 | 14 | |
15 | - public function __construct(array|string $initAttributes, |
|
15 | + public function __construct(array | string $initAttributes, |
|
16 | 16 | array $componentAttributes = [], |
17 | 17 | array $rules = [], |
18 | 18 | array $defaults = [], |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | |
27 | 27 | $item = $this->getItemByName((string) $this->getAttributeValue('name')); |
28 | 28 | if ($item) { |
29 | - $this->attributes = $this->buildAttributes((array)$item, $componentAttributes); |
|
29 | + $this->attributes = $this->buildAttributes((array) $item, $componentAttributes); |
|
30 | 30 | } else { |
31 | 31 | $this->addCollectionItem($this); |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - private function buildAttributes(array|string $attributes, $componentAttributes) |
|
35 | + private function buildAttributes(array | string $attributes, $componentAttributes) |
|
36 | 36 | { |
37 | 37 | if (is_string($attributes)) { |
38 | 38 | $attributes = ['name' => $attributes]; |
39 | 39 | } |
40 | 40 | |
41 | - $attributeNames = collect($componentAttributes)->mapWithKeys(function ($attribute) { |
|
41 | + $attributeNames = collect($componentAttributes)->mapWithKeys(function($attribute) { |
|
42 | 42 | return [$attribute::getAttributeName() => $attribute]; |
43 | 43 | })->toArray(); |
44 | 44 | |
45 | - return collect($attributes)->mapWithKeys(function ($value, $key) use ($attributeNames) { |
|
45 | + return collect($attributes)->mapWithKeys(function($value, $key) use ($attributeNames) { |
|
46 | 46 | if (isset($attributeNames[$key])) { |
47 | 47 | return [$key => $attributeNames[$key]::make($key, $value, $attributeNames[$key]::getValidationRules($this))]; |
48 | 48 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function getItemByName(string $name) |
72 | 72 | { |
73 | - return $this->getItems()->first(function ($item, $key) use ($name) { |
|
73 | + return $this->getItems()->first(function($item, $key) use ($name) { |
|
74 | 74 | return $key === $name; |
75 | 75 | }); |
76 | 76 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | private function getValidationRules() |
102 | 102 | { |
103 | 103 | $rules = []; |
104 | - foreach($this->attributes as $attribute) { |
|
104 | + foreach ($this->attributes as $attribute) { |
|
105 | 105 | $rules[$attribute->name()] = $attribute->rules(); |
106 | 106 | } |
107 | 107 | return $rules; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | public function toCollection(): Collection |
133 | 133 | { |
134 | - return $this->attributes->mapWithKeys(function ($item, $key) { |
|
134 | + return $this->attributes->mapWithKeys(function($item, $key) { |
|
135 | 135 | return [$key => $item->value()]; |
136 | 136 | }); |
137 | 137 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | private function setAttributeDefaults($componentAttributes) |
145 | 145 | { |
146 | 146 | foreach ($componentAttributes as $attribute) { |
147 | - if (! $this->hasAttribute($attribute::getAttributeName())) { |
|
147 | + if (!$this->hasAttribute($attribute::getAttributeName())) { |
|
148 | 148 | $this->attributes[$attribute::getAttributeName()] = $attribute::make($attribute::getAttributeName(), $attribute::getDefault($this), $attribute::getValidationRules($this)); |
149 | 149 | } |
150 | 150 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | class TextField extends BaseField |
11 | 11 | { |
12 | - public function __construct(string|array $attributes) |
|
12 | + public function __construct(string | array $attributes) |
|
13 | 13 | { |
14 | 14 | parent::__construct($attributes); |
15 | 15 | $this->attributes->setAttribute('type', 'text'); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class SelectFromModel extends BaseField |
10 | 10 | { |
11 | - public function __construct(string|array $attributes) |
|
11 | + public function __construct(string | array $attributes) |
|
12 | 12 | { |
13 | 13 | parent::__construct($attributes); |
14 | 14 | $this->attributes->setAttribute('type', 'select_from_model'); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | return [ |
32 | 32 | Entity::class, |
33 | - 'model' => function ($attributes) { |
|
33 | + 'model' => function($attributes) { |
|
34 | 34 | return app('crud')->inferModelFromRelationship($attributes->toArray()); |
35 | 35 | }, |
36 | 36 | ]; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function getCollection() |
10 | 10 | { |
11 | - return app('crud')->getOperationSetting('fields') ?? []; |
|
11 | + return app('crud')->getOperationSetting('fields') ?? []; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function saveCollection($collection) |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | return $this->attributes->getAttributes(); |
21 | 21 | } |
22 | 22 | |
23 | - public static function make(string|array $name): SmartComponentInterface |
|
23 | + public static function make(string | array $name): SmartComponentInterface |
|
24 | 24 | { |
25 | 25 | $attributes = new BaseCollection($name, static::attributes(), static::rules(), static::defaults(), static::blocked()); |
26 | 26 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function __call($name, $arguments) |
51 | 51 | { |
52 | - if (! method_exists($this, $name)) { |
|
52 | + if (!method_exists($this, $name)) { |
|
53 | 53 | if ($this->isAttributeBlocked($name)) { |
54 | 54 | throw new \Exception("Attribute {$name} cannot be changed in this component."); |
55 | 55 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class Page |
9 | 9 | { |
10 | - public static function button(string|array $name) |
|
10 | + public static function button(string | array $name) |
|
11 | 11 | { |
12 | 12 | } |
13 | 13 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @param string|array $input |
18 | 18 | * @return Field |
19 | 19 | */ |
20 | - public static function field(string|array $input) |
|
20 | + public static function field(string | array $input) |
|
21 | 21 | { |
22 | 22 | return new BaseField($input); |
23 | 23 | } |
@@ -17,18 +17,18 @@ |
||
17 | 17 | { |
18 | 18 | return [ |
19 | 19 | 'required', |
20 | - function ($attribute, $value, $fail) use ($attributes) { |
|
20 | + function($attribute, $value, $fail) use ($attributes) { |
|
21 | 21 | |
22 | 22 | if ($attributes->hasAttribute('entity') && $attributes->getAttributeValue('entity')) { |
23 | - if (! is_string($value)) { |
|
23 | + if (!is_string($value)) { |
|
24 | 24 | $fail('The '.$attribute.' should be a valid model string.'); |
25 | 25 | } |
26 | 26 | |
27 | - if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
|
27 | + if (!is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
|
28 | 28 | $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .'); |
29 | 29 | } |
30 | - }else{ |
|
31 | - if($value !== false){ |
|
30 | + } else { |
|
31 | + if ($value !== false) { |
|
32 | 32 | $fail('The '.$attribute.' should be either false or a valid class that extends Illuminate\Database\Eloquent\Model.'); |
33 | 33 | } |
34 | 34 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
28 | 28 | $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .'); |
29 | 29 | } |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | if($value !== false){ |
32 | 32 | $fail('The '.$attribute.' should be either false or a valid class that extends Illuminate\Database\Eloquent\Model.'); |
33 | 33 | } |
@@ -17,9 +17,9 @@ |
||
17 | 17 | public static function getValidationRules(SmartCollectionInterface $attributes): array |
18 | 18 | { |
19 | 19 | return [ |
20 | - function ($attribute, $value, $fail) use ($attributes) { |
|
20 | + function($attribute, $value, $fail) use ($attributes) { |
|
21 | 21 | if ($attributes->hasAttribute('entity') && $attributes->getAttributeValue('entity')) { |
22 | - if (! is_string($value)) { |
|
22 | + if (!is_string($value)) { |
|
23 | 23 | $fail('The '.$attribute.' should be a valid relation type string.'); |
24 | 24 | } |
25 | 25 | } |