Resource   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 22
c 2
b 0
f 0
dl 0
loc 114
rs 10
wmc 13

13 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 3 1
A setKey() 0 3 1
A setTable() 0 3 1
A __construct() 0 3 1
A setNull() 0 3 1
A setColumns() 0 3 1
A getTypes() 0 3 1
A setDefault() 0 3 1
A getNull() 0 3 1
A getTable() 0 3 1
A getColumns() 0 3 1
A setTypes() 0 3 1
A getDefault() 0 3 1
1
<?php
2
3
namespace Erykai\Migration;
4
5
use PDO;
6
7
abstract class Resource
8
{
9
    use TraitMigration;
10
11
    /**
12
     * @var PDO
13
     */
14
    protected PDO $conn;
15
    private string $table;
16
    private array $columns;
17
    private array $types;
18
    protected array $null;
19
    private array $default;
20
    private string $key;
21
22
    public function __construct()
23
    {
24
        $this->conn();
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    protected function getTable(): string
31
    {
32
        return $this->table;
33
    }
34
35
    /**
36
     * @param string $table
37
     */
38
    protected function setTable(string $table): void
39
    {
40
        $this->table = $table;
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    protected function getColumns(): array
47
    {
48
        return $this->columns;
49
    }
50
51
    /**
52
     * @param string $column
53
     */
54
    protected function setColumns(string $column): void
55
    {
56
        $this->columns[] = $column;
57
    }
58
59
    /**
60
     * @return array
61
     */
62
    protected function getTypes(): array
63
    {
64
        return $this->types;
65
    }
66
67
    /**
68
     * @param string $type
69
     */
70
    protected function setTypes(string $type): void
71
    {
72
        $this->types[] = $type;
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    protected function getNull(): array
79
    {
80
        return $this->null;
81
    }
82
83
    /**
84
     * @param string $null
85
     */
86
    protected function setNull(string $null): void
87
    {
88
        $this->null[] = $null;
89
    }
90
91
    /**
92
     * @return array
93
     */
94
    protected function getDefault(): array
95
    {
96
        return $this->default;
97
    }
98
99
    /**
100
     * @param bool|string $default
101
     */
102
    protected function setDefault(bool|string $default): void
103
    {
104
        $this->default[] = $default;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    protected function getKey(): string
111
    {
112
        return $this->key;
113
    }
114
115
    /**
116
     * @param string $key
117
     */
118
    protected function setKey(string $key): void
119
    {
120
        $this->key = $key;
121
    }
122
}