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

RelationType   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 7

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValidationRules() 0 7 4
A getAttributeName() 0 3 1
A getDefault() 0 3 2
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
use Backpack\CRUD\app\Library\Components\Interfaces\SmartComponentInterface;
9
10
class RelationType extends BaseAttribute implements SmartAttributeInterface
11
{
12
    public static function getDefault(SmartCollectionInterface $attributes)
13
    {
14
        return $attributes->getAttributeValue('entity') ? app('crud')->inferRelationTypeFromRelationship($attributes->toArray()) : false;
15
    }
16
17
    public static function getValidationRules(SmartCollectionInterface $attributes): array
18
    {
19
        return [
20
            function ($attribute, $value, $fail) use ($attributes) {
21
                if ($attributes->hasAttribute('entity') && $attributes->getAttributeValue('entity')) {
22
                    if (! is_string($value)) {
23
                        $fail('The '.$attribute.' should be a valid relation type string.');
24
                    }
25
                }
26
            }
27
        ];
28
    }
29
30
    public static function getAttributeName(): string
31
    {
32
        return 'relation_type';
33
    }
34
}
35