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