1 | <?php |
||
5 | class Column |
||
6 | { |
||
7 | /** |
||
8 | * @var \BfwSql\Queries\Parts\Table $table The table where is the column |
||
9 | */ |
||
10 | protected $table; |
||
11 | |||
12 | /** |
||
13 | * @var string $name The column name |
||
14 | */ |
||
15 | protected $name; |
||
16 | |||
17 | /** |
||
18 | * @var string|null $shortcut The column shortcut |
||
19 | */ |
||
20 | protected $shortcut; |
||
21 | |||
22 | /** |
||
23 | * @var mixed $value The column shortcut |
||
24 | */ |
||
25 | protected $value; |
||
26 | |||
27 | /** |
||
28 | * Construct |
||
29 | * |
||
30 | * @param \BfwSql\Queries\Parts\Table $table The table where is the column |
||
31 | * @param string $name The column name |
||
32 | * @param string $shortcut The column shortcut |
||
33 | * @param mixed $value The column value |
||
34 | */ |
||
35 | public function __construct( |
||
46 | |||
47 | /** |
||
48 | * Getter accessor to property table |
||
49 | * |
||
50 | * @return \BfwSql\Queries\Parts\Table |
||
51 | */ |
||
52 | public function getTable(): Table |
||
56 | |||
57 | /** |
||
58 | * Getter accessor to property name |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getName(): string |
||
66 | |||
67 | /** |
||
68 | * Getter accessor to property shortcut |
||
69 | * |
||
70 | * @return string|null |
||
71 | */ |
||
72 | public function getShortcut() |
||
76 | |||
77 | /** |
||
78 | * Getter accessor to property value |
||
79 | * |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function getValue() |
||
86 | |||
87 | /** |
||
88 | * Generate the sql query for to this column |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function generate(): string |
||
101 | |||
102 | /** |
||
103 | * Obtain the column name to use into the sql query |
||
104 | * Use shortcut if defined |
||
105 | * Use backtick if needed (not a function or a keyword) |
||
106 | * Add the table name before the column name |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | public function obtainName(): string |
||
133 | |||
134 | /** |
||
135 | * Obtain the value to use into sql query |
||
136 | * Return the string null if the column have the value null in php |
||
137 | * Use quoting system declared into the used query system |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function obtainValue() |
||
154 | } |
||
155 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: