Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — test-upload-2 ( 381bf4 )
by Pedro
38:13 queued 23:20
created

ValidUpload   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 31
rs 10
wmc 7

2 Methods

Rating   Name   Duplication   Size   Complexity  
A field() 0 3 1
A validateRules() 0 21 6
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Validation\Rules;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade;
6
use Illuminate\Contracts\Validation\Rule;
7
use Illuminate\Contracts\Validation\ValidationRule;
8
use Illuminate\Support\Arr;
9
use Illuminate\Support\Str;
10
11
class ValidUpload extends BackpackCustomRule
12
{
13
    /**
14
     * Run the validation rule and return the array of errors.
15
     */
16
    public function validateRules(string $attribute, mixed $value): array
17
    {
18
        $entry = CrudPanelFacade::getCurrentEntry();
0 ignored issues
show
Bug introduced by
The method getCurrentEntry() does not exist on Backpack\CRUD\app\Librar...udPanel\CrudPanelFacade. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        /** @scrutinizer ignore-call */ 
19
        $entry = CrudPanelFacade::getCurrentEntry();
Loading history...
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
    }
38
39
    public static function field(string|array|ValidationRule|Rule $rules = []): self
40
    {
41
        return parent::field($rules);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::field($rules) returns the type Backpack\CRUD\app\Librar...ules\BackpackCustomRule which includes types incompatible with the type-hinted return Backpack\CRUD\app\Librar...ation\Rules\ValidUpload.
Loading history...
42
    }
43
}
44