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
Pull Request — main (#4854)
by Pedro
36:02 queued 23:20
created

SelectFromModel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 38
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A model() 0 5 1
A getAttributeDefaults() 0 6 1
A getBlockedAttributes() 0 3 1
A getAttributeValidationRules() 0 15 2
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Components\Fields;
4
5
use Backpack\CRUD\app\Library\Components\Attributes\EntityAttribute;
6
use Backpack\CRUD\app\Library\Components\Attributes\FieldType;
0 ignored issues
show
Bug introduced by
The type Backpack\CRUD\app\Librar...ts\Attributes\FieldType was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class SelectFromModel extends Field
9
{
10
    public static function getBlockedAttributes(): array
11
    {
12
        return [FieldType::class];
13
    }
14
15
    public function model(string $model): self
16
    {
17
        $this->setAttribute('model', $model);
18
19
        return $this;
20
    }
21
22
    public static function getAttributeValidationRules(): array
23
    {
24
        return [
25
            'model' => [
26
                'required',
27
                'string',
28
                function ($attribute, $value, $fail) {
29
                    if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) {
30
                        $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .');
31
                    }
32
                },
33
            ],
34
            'attribute' => ['required', 'string'],
35
            EntityAttribute::class,
36
            'value'     => ['nullable', 'integer'],
37
        ];
38
    }
39
40
    public static function getAttributeDefaults(): array
41
    {
42
        return [
43
            EntityAttribute::class,
44
            'model'  => function ($attributes) {
45
                return app('BSL')->inferComponentModelFromRelationship($attributes->getAttributes());
46
            },
47
        ];
48
    }
49
}
50