1 | <?php |
||
10 | class Builder |
||
11 | { |
||
12 | /** |
||
13 | * The database connection instance. |
||
14 | * |
||
15 | * @var \Illuminate\Database\Connection |
||
16 | */ |
||
17 | protected $connection; |
||
18 | |||
19 | protected $collectionHandler; |
||
20 | |||
21 | protected $graphHandler; |
||
22 | |||
23 | protected $viewHandler; |
||
24 | |||
25 | /** |
||
26 | * The schema grammar instance. |
||
27 | * |
||
28 | * @var Grammar |
||
29 | */ |
||
30 | protected $grammar; |
||
31 | |||
32 | /** |
||
33 | * The Blueprint resolver callback. |
||
34 | * |
||
35 | * @var \Closure |
||
36 | */ |
||
37 | protected $resolver; |
||
38 | |||
39 | /** |
||
40 | * Create a new database Schema manager. |
||
41 | * |
||
42 | * Builder constructor. |
||
43 | * @param Connection $connection |
||
44 | */ |
||
45 | public function __construct(Connection $connection) |
||
57 | |||
58 | /** |
||
59 | * Create a new collection on the schema. |
||
60 | * |
||
61 | * @param string $collection |
||
62 | * @param Closure $callback |
||
63 | * @param array $config |
||
64 | * @return void |
||
65 | */ |
||
66 | public function create($collection, Closure $callback, $config = []) |
||
74 | |||
75 | /** |
||
76 | * Create a new command set with a Closure. |
||
77 | * |
||
78 | * @param string $collection |
||
79 | * @param \Closure|null $callback |
||
80 | * @return Blueprint |
||
81 | */ |
||
82 | protected function createBlueprint($collection, Closure $callback = null) |
||
93 | |||
94 | protected function build(Blueprint $blueprint) |
||
98 | |||
99 | /** |
||
100 | * Set the Schema Blueprint resolver callback. |
||
101 | * |
||
102 | * @param Closure $resolver |
||
103 | * @return void |
||
104 | */ |
||
105 | public function blueprintResolver(Closure $resolver) |
||
109 | |||
110 | /** |
||
111 | * Alias for table. |
||
112 | * |
||
113 | * @param string $collection |
||
114 | * @param Closure $callback |
||
115 | * @return void |
||
116 | */ |
||
117 | public function collection($collection, Closure $callback) |
||
122 | |||
123 | /** |
||
124 | * Modify a table's schema. |
||
125 | * |
||
126 | * @param string $table |
||
127 | * @param Closure $callback |
||
128 | * @return void |
||
129 | */ |
||
130 | public function table($table, Closure $callback) |
||
135 | |||
136 | /** |
||
137 | * Drop a collection from the schema. |
||
138 | * |
||
139 | * @param string $collection |
||
140 | * @return void |
||
141 | * @throws \ArangoDBClient\Exception |
||
142 | */ |
||
143 | public function drop($collection) |
||
147 | |||
148 | public function dropAllCollections() |
||
156 | |||
157 | /** |
||
158 | * Alias for dropAllCollections. |
||
159 | * |
||
160 | * @return void |
||
161 | */ |
||
162 | public function dropAllTables() |
||
166 | |||
167 | /** |
||
168 | * @param $collection |
||
169 | * @throws \ArangoDBClient\Exception |
||
170 | */ |
||
171 | public function dropIfExists($collection) |
||
177 | |||
178 | /** |
||
179 | * Get all of the collection names for the database. |
||
180 | * |
||
181 | * @param array $options |
||
182 | * @return array |
||
183 | * @throws \ArangoDBClient\ClientException |
||
184 | * @throws \ArangoDBClient\Exception |
||
185 | */ |
||
186 | protected function getAllCollections(array $options = []) |
||
194 | |||
195 | /** |
||
196 | * Get all of the table names for the database. |
||
197 | * Alias for getAllCollections(). |
||
198 | * |
||
199 | * @param array $options |
||
200 | * @return array |
||
201 | * @throws \ArangoDBClient\ClientException |
||
202 | * @throws \ArangoDBClient\Exception |
||
203 | */ |
||
204 | protected function getAllTables(array $options = []) |
||
208 | |||
209 | /** |
||
210 | * @param string $collection |
||
211 | * @return \ArangoDBClient\Collection |
||
212 | * @throws \ArangoDBClient\Exception |
||
213 | */ |
||
214 | protected function getCollection($collection) |
||
218 | |||
219 | /** |
||
220 | * Rename a collection. |
||
221 | * |
||
222 | * @param $from |
||
223 | * @param $to |
||
224 | * @return bool |
||
225 | * @throws \ArangoDBClient\Exception |
||
226 | */ |
||
227 | public function rename($from, $to) |
||
231 | |||
232 | /** |
||
233 | * Determine if the given collection exists. |
||
234 | * |
||
235 | * @param string $collection |
||
236 | * @return bool |
||
237 | * @throws \ArangoDBClient\Exception |
||
238 | */ |
||
239 | public function hasCollection(string $collection) |
||
243 | |||
244 | /** |
||
245 | * Alias for hasCollection. |
||
246 | * |
||
247 | * @param string $table |
||
248 | * @return bool |
||
249 | * @throws \ArangoDBClient\Exception |
||
250 | */ |
||
251 | public function hasTable($table) |
||
255 | |||
256 | /** |
||
257 | * Check if any document in the collection has the attribute. |
||
258 | * |
||
259 | * @param string $collection |
||
260 | * @param string $attribute |
||
261 | * @return bool |
||
262 | */ |
||
263 | public function hasAttribute($collection, $attribute) |
||
271 | |||
272 | /** |
||
273 | * Check if any document in the collection has the attribute. |
||
274 | * |
||
275 | * @param string $collection |
||
276 | * @param array $attributes |
||
277 | * @return bool |
||
278 | */ |
||
279 | public function hasAttributes($collection, $attributes) |
||
290 | |||
291 | /** |
||
292 | * Alias for hasAttribute. |
||
293 | * |
||
294 | * @param string $table |
||
295 | * @param string $column |
||
296 | * @return bool |
||
297 | */ |
||
298 | public function hasColumn($table, $column) |
||
302 | |||
303 | /** |
||
304 | * Alias for hasAttributes. |
||
305 | * |
||
306 | * @param string $table |
||
307 | * @param array $columns |
||
308 | * @return bool |
||
309 | */ |
||
310 | public function hasColumns($table, $columns) |
||
314 | |||
315 | /** |
||
316 | * get information about the collection. |
||
317 | * |
||
318 | * @param $collection |
||
319 | * @return mixed |
||
320 | */ |
||
321 | public function getCollectionInfo($collection) |
||
325 | |||
326 | |||
327 | /** |
||
328 | * @param string $name |
||
329 | * @param array $properties |
||
330 | * @param string $type |
||
331 | * @throws \ArangoDBClient\ClientException |
||
332 | * @throws \ArangoDBClient\Exception |
||
333 | */ |
||
334 | public function createView($name, array $properties, $type = 'arangosearch') |
||
341 | |||
342 | /** |
||
343 | * @param string $name |
||
344 | * @return mixed |
||
345 | * @throws \ArangoDBClient\Exception |
||
346 | */ |
||
347 | public function getView(string $name) |
||
351 | |||
352 | /** |
||
353 | * @param string $name |
||
354 | * @param array $properties |
||
355 | * @throws \ArangoDBClient\ClientException |
||
356 | * @throws \ArangoDBClient\Exception |
||
357 | */ |
||
358 | public function editView($name, array $properties) |
||
362 | |||
363 | /** |
||
364 | * @param string $from |
||
365 | * @param string $to |
||
366 | * @throws \ArangoDBClient\Exception |
||
367 | */ |
||
368 | public function renameView(string $from, string $to) |
||
372 | |||
373 | /** |
||
374 | * @param string $name |
||
375 | * @throws \ArangoDBClient\ClientException |
||
376 | * @throws \ArangoDBClient\Exception |
||
377 | */ |
||
378 | public function dropView(string $name) |
||
382 | |||
383 | /** |
||
384 | * Get the database connection instance. |
||
385 | * |
||
386 | * @return Connection |
||
387 | */ |
||
388 | public function getConnection() |
||
392 | |||
393 | /** |
||
394 | * Silently catch the use of unsupported builder methods. |
||
395 | * |
||
396 | * @param $method |
||
397 | * @param $args |
||
398 | * @return null |
||
399 | */ |
||
400 | public function __call($method, $args) |
||
404 | } |
||
405 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.