| Total Complexity | 13 |
| Total Lines | 114 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @param string $key |
||
| 117 | */ |
||
| 118 | protected function setKey(string $key): void |
||
| 121 | } |
||
| 122 | } |