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 — add-span-to-buttons ( b5e4e4...27bfb1 )
by Pedro
28:14
created

Table::__construct()

Size

Total Lines 41
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
nc 2
nop 2
dl 0
loc 41

8 Methods

Rating   Name   Duplication   Size   Complexity  
A Table.php$0 ➔ getType() 0 11 1
A Table.php$1 ➔ getNotnull() 0 3 1
A Table.php$0 ➔ getName() 0 3 1
A Table.php$1 ➔ getUnsigned() 0 3 1
A Table.php$1 ➔ getDefault() 0 3 1
A Table.php$1 ➔ getName() 0 3 1
A Table.php$1 ➔ __construct() 0 2 1
A Table.php$0 ➔ __construct() 0 2 2
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 = [])
12
    {
13
        $this->name = $name;
14
        foreach ($columns as $column) {
15
            $this->columns[$column['name']] = new class($column)
16
            {
17
                public function __construct(private array $column)
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 $this->column['default'];
34
                }
35
36
                public function getUnsigned()
37
                {
38
                    return in_array('unsigned', explode(' ', $this->column['type']));
39
                }
40
41
                public function getType()
42
                {
43
                    return new class($this->column)
44
                    {
45
                        public function __construct(private array $column)
46
                        {
47
                        }
48
49
                        public function getName()
50
                        {
51
                            return $this->column['type_name'];
52
                        }
53
                    };
54
                }
55
            };
56
        }
57
    }
58
59
    public function getName(): string
60
    {
61
        return $this->name;
62
    }
63
64
    public function getColumns()
65
    {
66
        return $this->columns;
67
    }
68
69
    public function hasColumn(string $columnName)
70
    {
71
        return isset($this->columns[$columnName]);
72
    }
73
74
    public function getColumn(string $columnName)
75
    {
76
        return $this->columns[$columnName];
77
    }
78
79
    public function getIndexes()
80
    {
81
        return $this->indexes;
82
    }
83
84
    public function setIndexes(array $indexes)
85
    {
86
        $this->indexes = $indexes;
87
    }
88
}
89