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 — poc-backpack-components ( 0ddd2c...dbc69d )
by Pedro
26:57
created

Model   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 9

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefault() 0 3 2
A getValidationRules() 0 17 6
A getAttributeName() 0 3 1
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Components\Attributes;
4
5
use Backpack\CRUD\app\Library\Components\AttributeCollection;
0 ignored issues
show
Bug introduced by
The type Backpack\CRUD\app\Librar...nts\AttributeCollection 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...
6
use Backpack\CRUD\app\Library\Components\Interfaces\SmartAttributeInterface;
7
use Backpack\CRUD\app\Library\Components\Interfaces\SmartCollectionInterface;
8
9
class Model extends BaseAttribute implements SmartAttributeInterface
10
{
11
    public static function getDefault(SmartCollectionInterface $attributes)
12
    {
13
        return $attributes->getAttributeValue('relation_type') ? app('crud')->inferFieldModelFromRelationship($attributes->toArray()) : false;
14
    }
15
16
    public static function getValidationRules(SmartCollectionInterface $attributes): array
17
    {
18
        return [
19
            'required',
20
            function ($attribute, $value, $fail) use ($attributes) {
21
                
22
                if ($attributes->hasAttribute('entity') && $attributes->getAttributeValue('entity')) {
23
                    if (! is_string($value)) {
24
                        $fail('The '.$attribute.' should be a valid model string.');
25
                    }
26
27
                    if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) {
28
                        $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .');
29
                    }
30
                }else{
31
                    if($value !== false){
32
                        $fail('The '.$attribute.' should be either false or a valid class that extends Illuminate\Database\Eloquent\Model.');
33
                    }
34
                }
35
36
            },
37
        ];
38
    }
39
40
    public static function getAttributeName(): string
41
    {
42
        return 'model';
43
    }
44
}
45