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 — translatable-with-fallbacks ( b664d2...21ea85 )
by Pedro
11:44
created

Table.php$0 ➔ setIndexes()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
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
10
    public function __construct(string $name, array $columns = [])
11
    {
12
        $this->name = $name;
13
        foreach ($columns as $column) {
14
            $this->columns[$column['name']] = new class($column)
15
            {
16
                public function __construct(private array $column)
17
                {
18
                }
19
20
                public function getName()
21
                {
22
                    return $this->column['name'];
23
                }
24
25
                public function getNotnull()
26
                {
27
                    return ! $this->column['nullable'];
28
                }
29
30
                public function getDefault()
31
                {
32
                    return $this->column['default'];
33
                }
34
35
                public function getUnsigned()
36
                {
37
                    return in_array('unsigned', explode(' ', $this->column['type']));
38
                }
39
40
                public function getType()
41
                {
42
                    return new class($this->column)
43
                    {
44
                        public function __construct(private array $column)
45
                        {
46
                        }
47
48
                        public function getName()
49
                        {
50
                            return $this->column['type_name'];
51
                        }
52
                    };
53
                }
54
            };
55
        }
56
    }
57
58
    public function getName(): string
59
    {
60
        return $this->name;
61
    }
62
63
    public function getColumns()
64
    {
65
        return $this->columns;
66
    }
67
68
    public function hasColumn(string $columnName)
69
    {
70
        return isset($this->columns[$columnName]);
71
    }
72
73
    public function getColumn(string $columnName)
74
    {
75
        return $this->columns[$columnName];
76
    }
77
}
78