Total Complexity | 4 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | abstract class AbstractTable implements ArrayAccess |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * Returns the SQL reference qualifier (i.e. the table name) |
||
17 | * |
||
18 | * @return string |
||
19 | */ |
||
20 | abstract public function __toString(); |
||
21 | |||
22 | /** |
||
23 | * Columns keyed by name/alias. |
||
24 | * |
||
25 | * @return Column[] |
||
26 | */ |
||
27 | abstract public function getColumns(); |
||
28 | |||
29 | /** |
||
30 | * @param string $column |
||
31 | * @return null|Column |
||
32 | */ |
||
33 | abstract public function offsetGet($column); |
||
34 | |||
35 | /** |
||
36 | * @var DB |
||
37 | */ |
||
38 | protected $db; |
||
39 | |||
40 | /** |
||
41 | * @param DB $db |
||
42 | */ |
||
43 | public function __construct(DB $db) |
||
44 | { |
||
45 | $this->db = $db; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param int|string $column |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function offsetExists($column): bool |
||
53 | { |
||
54 | return $this->offsetGet($column) !== null; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Throws. |
||
59 | * |
||
60 | * @param void $offset |
||
61 | * @param void $value |
||
62 | * @throws Exception |
||
63 | */ |
||
64 | final public function offsetSet($offset, $value): void |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Throws. |
||
71 | * |
||
72 | * @param void $name |
||
73 | * @throws Exception |
||
74 | */ |
||
75 | final public function offsetUnset($name): void |
||
78 | } |
||
79 | } |
||
80 |