We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 7 |
| Paths | 7 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 15 | public function validateRules(string $attribute, mixed $value): array |
||
| 16 | { |
||
| 17 | $entry = CrudPanelFacade::getCurrentEntry(); |
||
|
|
|||
| 18 | |||
| 19 | if (! Arr::has($this->data, $attribute)) { |
||
| 20 | if($entry && ! str_contains($attribute, '.')) { |
||
| 21 | return []; |
||
| 22 | } |
||
| 23 | $requestAttributeValue = Arr::get($this->data, '_order_'.$attribute); |
||
| 24 | $attributeValueForDataArray = $entry ? $requestAttributeValue : null; |
||
| 25 | |||
| 26 | Arr::set($this->data, $attribute, $attributeValueForDataArray); |
||
| 27 | } |
||
| 28 | |||
| 29 | $fieldErrors = $this->validateFieldRules($attribute, $value); |
||
| 30 | |||
| 31 | if (! empty($value) && ! empty($this->getFileRules())) { |
||
| 32 | $fileErrors = $this->validateFileRules($attribute, $value); |
||
| 33 | } |
||
| 34 | |||
| 35 | return array_merge($fieldErrors, $fileErrors ?? []); |
||
| 36 | } |
||
| 43 |