1 | <?php |
||
17 | class Identifier { |
||
18 | private $parts; |
||
19 | |||
20 | /** |
||
21 | * Identifier constructor. |
||
22 | * @param array ...$identifier |
||
23 | */ |
||
24 | 5 | public function __construct(...$identifier) { |
|
25 | 5 | if (empty($identifier) || empty($identifier[0])) { |
|
26 | throw new \InvalidArgumentException("The identifier is empty.", 500); |
||
27 | } |
||
28 | 5 | if (count($identifier) === 1) { |
|
29 | $this->parts = explode('.', $identifier[0]); |
||
30 | } else { |
||
31 | 5 | $this->parts = $identifier; |
|
32 | } |
||
33 | 5 | } |
|
34 | |||
35 | /** |
||
36 | * Convert the identifier to a simple string. |
||
37 | * |
||
38 | * @return string Returns the identifier as a string. |
||
39 | */ |
||
40 | public function __toString() { |
||
43 | |||
44 | /** |
||
45 | * Escape the identifier. |
||
46 | * |
||
47 | * @param Db $db The database used to escape the identifier. |
||
48 | * @return string Returns the full escaped identifier. |
||
49 | */ |
||
50 | 5 | public function escape(Db $db) { |
|
53 | } |
||
54 |