1 | <?php |
||
15 | abstract class AbstractCommander |
||
16 | { |
||
17 | /** |
||
18 | * @var Driver |
||
19 | */ |
||
20 | private $driver = null; |
||
21 | |||
22 | /** |
||
23 | * @param Driver $driver |
||
24 | */ |
||
25 | public function __construct(Driver $driver) |
||
29 | |||
30 | /** |
||
31 | * Associated driver. |
||
32 | * |
||
33 | * @return Driver |
||
34 | */ |
||
35 | public function driver() |
||
39 | |||
40 | /** |
||
41 | * Create table! |
||
42 | * |
||
43 | * @param AbstractTable $table |
||
44 | * @return self |
||
45 | */ |
||
46 | public function createTable(AbstractTable $table) |
||
58 | |||
59 | /** |
||
60 | * Drop table from database. |
||
61 | * |
||
62 | * @param string $table |
||
63 | */ |
||
64 | public function dropTable($table) |
||
68 | |||
69 | /** |
||
70 | * Rename table from one name to another. |
||
71 | * |
||
72 | * @param string $table |
||
73 | * @param string $name |
||
74 | * @return self |
||
75 | */ |
||
76 | public function renameTable($table, $name) |
||
82 | |||
83 | /** |
||
84 | * Driver specific column add command. |
||
85 | * |
||
86 | * @param AbstractTable $table |
||
87 | * @param AbstractColumn $column |
||
88 | * @return self |
||
89 | */ |
||
90 | public function addColumn(AbstractTable $table, AbstractColumn $column) |
||
96 | |||
97 | /** |
||
98 | * Driver specific column remove (drop) command. |
||
99 | * |
||
100 | * @param AbstractTable $table |
||
101 | * @param AbstractColumn $column |
||
102 | * @return self |
||
103 | */ |
||
104 | public function dropColumn(AbstractTable $table, AbstractColumn $column) |
||
115 | |||
116 | /** |
||
117 | * Driver specific column alter command. |
||
118 | * |
||
119 | * @param AbstractTable $table |
||
120 | * @param AbstractColumn $initial |
||
121 | * @param AbstractColumn $column |
||
122 | * @return self |
||
123 | */ |
||
124 | abstract public function alterColumn( |
||
129 | |||
130 | /** |
||
131 | * Driver specific index adding command. |
||
132 | * |
||
133 | * @param AbstractTable $table |
||
134 | * @param AbstractIndex $index |
||
135 | * @return self |
||
136 | */ |
||
137 | public function addIndex(AbstractTable $table, AbstractIndex $index) |
||
143 | |||
144 | /** |
||
145 | * Driver specific index remove (drop) command. |
||
146 | * |
||
147 | * @param AbstractTable $table |
||
148 | * @param AbstractIndex $index |
||
149 | * @return self |
||
150 | */ |
||
151 | public function dropIndex(AbstractTable $table, AbstractIndex $index) |
||
157 | |||
158 | /** |
||
159 | * Driver specific index alter command, by default it will remove and add index. |
||
160 | * |
||
161 | * @param AbstractTable $table |
||
162 | * @param AbstractIndex $initial |
||
163 | * @param AbstractIndex $index |
||
164 | * @return self |
||
165 | */ |
||
166 | public function alterIndex(AbstractTable $table, AbstractIndex $initial, AbstractIndex $index) |
||
170 | |||
171 | /** |
||
172 | * Driver specific foreign key adding command. |
||
173 | * |
||
174 | * @param AbstractTable $table |
||
175 | * @param AbstractReference $foreign |
||
176 | * @return self |
||
177 | */ |
||
178 | public function addForeign(AbstractTable $table, AbstractReference $foreign) |
||
184 | |||
185 | /** |
||
186 | * Driver specific foreign key remove (drop) command. |
||
187 | * |
||
188 | * @param AbstractTable $table |
||
189 | * @param AbstractReference $foreign |
||
190 | * @return self |
||
191 | */ |
||
192 | public function dropForeign(AbstractTable $table, AbstractReference $foreign) |
||
196 | |||
197 | /** |
||
198 | * Driver specific foreign key alter command, by default it will remove and add foreign key. |
||
199 | * |
||
200 | * @param AbstractTable $table |
||
201 | * @param AbstractReference $initial |
||
202 | * @param AbstractReference $foreign |
||
203 | * @return self |
||
204 | */ |
||
205 | public function alterForeign( |
||
212 | |||
213 | /** |
||
214 | * Drop column constraint using it's name. |
||
215 | * |
||
216 | * @param AbstractTable $table |
||
217 | * @param string $constraint |
||
218 | * @return self |
||
219 | */ |
||
220 | public function dropConstrain(AbstractTable $table, $constraint) |
||
226 | |||
227 | /** |
||
228 | * Execute statement. |
||
229 | * |
||
230 | * @param string $statement |
||
231 | * @param array $parameters |
||
232 | * @return \PDOStatement |
||
233 | */ |
||
234 | protected function run($statement, array $parameters = []) |
||
238 | |||
239 | /** |
||
240 | * Quote identifier. |
||
241 | * |
||
242 | * @param string $identifier |
||
243 | * @return string |
||
244 | */ |
||
245 | protected function quote($identifier) |
||
249 | |||
250 | /** |
||
251 | * Get statement needed to create table. |
||
252 | * |
||
253 | * @param AbstractTable $table |
||
254 | * @return string |
||
255 | */ |
||
256 | protected function createStatement(AbstractTable $table) |
||
283 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.