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 — main ( d89ce8...752c34 )
by Pedro
16:05 queued 25s
created

Table.php$1 ➔ getDefault()   B

Complexity

Conditions 8

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 2 Features 0
Metric Value
c 3
b 2
f 0
dl 0
loc 7
cc 8
rs 8.4444
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Database;
4
5
final class Table
6
{
7
    private string $name;
8
    private array $columns = [];
9
    private array $indexes = [];
10
11
    public function __construct(string $name, array $columns = [], $schemaManager = null)
12
    {
13
        $this->name = $name;
14
        foreach ($columns as $column) {
15
            $this->columns[$column['name']] = new class($column, $schemaManager)
16
            {
17
                public function __construct(private array $column, private $schemaManager)
18
                {
19
                }
20
21
                public function getName()
22
                {
23
                    return $this->column['name'];
24
                }
25
26
                public function getNotnull()
27
                {
28
                    return ! $this->column['nullable'];
29
                }
30
31
                public function getDefault()
32
                {
33
                    return isset($this->schemaManager) && class_exists(\Illuminate\Database\MariaDbConnection::class) ?
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\MariaDbConnection 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...
34
                        (is_a($this->schemaManager->getConnection(), \Illuminate\Database\MariaDbConnection::class) &&
35
                            is_string($this->column['default']) &&
36
                            $this->column['nullable'] === true &&
37
                            ($this->column['default'] === 'null' || $this->column['default'] === 'NULL') ? null : $this->column['default']) : $this->column['default'];
38
                }
39
40
                public function getUnsigned()
41
                {
42
                    return in_array('unsigned', explode(' ', $this->column['type']));
43
                }
44
45
                public function getType()
46
                {
47
                    return new class($this->column)
48
                    {
49
                        public function __construct(private array $column)
50
                        {
51
                        }
52
53
                        public function getName()
54
                        {
55
                            return $this->column['type_name'];
56
                        }
57
                    };
58
                }
59
            };
60
        }
61
    }
62
63
    public function getName(): string
64
    {
65
        return $this->name;
66
    }
67
68
    public function getColumns()
69
    {
70
        return $this->columns;
71
    }
72
73
    public function hasColumn(string $columnName)
74
    {
75
        return isset($this->columns[$columnName]);
76
    }
77
78
    public function getColumn(string $columnName)
79
    {
80
        return $this->columns[$columnName];
81
    }
82
83
    public function getIndexes()
84
    {
85
        return $this->indexes;
86
    }
87
88
    public function setIndexes(array $indexes)
89
    {
90
        $this->indexes = $indexes;
91
    }
92
}
93