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) |
||
121 | |||
122 | /** |
||
123 | * Modify a table's schema. |
||
124 | * |
||
125 | * @param string $table |
||
126 | * @param Closure $callback |
||
127 | * @return void |
||
128 | */ |
||
129 | public function table($table, Closure $callback) |
||
133 | |||
134 | /** |
||
135 | * Drop a collection from the schema. |
||
136 | * |
||
137 | * @param string $collection |
||
138 | * @return void |
||
139 | * @throws \ArangoDBClient\Exception |
||
140 | */ |
||
141 | public function drop($collection) |
||
145 | |||
146 | public function dropAllCollections() |
||
154 | |||
155 | /** |
||
156 | * Alias for dropAllCollections. |
||
157 | * |
||
158 | * @return void |
||
159 | */ |
||
160 | public function dropAllTables() |
||
164 | |||
165 | /** |
||
166 | * @param $collection |
||
167 | * @throws \ArangoDBClient\Exception |
||
168 | */ |
||
169 | public function dropIfExists($collection) |
||
175 | |||
176 | /** |
||
177 | * Get all of the collection names for the database. |
||
178 | * |
||
179 | * @param array $options |
||
180 | * @return array |
||
181 | * @throws \ArangoDBClient\ClientException |
||
182 | * @throws \ArangoDBClient\Exception |
||
183 | */ |
||
184 | protected function getAllCollections(array $options = []) |
||
192 | |||
193 | /** |
||
194 | * Get all of the table names for the database. |
||
195 | * Alias for getAllCollections(). |
||
196 | * |
||
197 | * @param array $options |
||
198 | * @return array |
||
199 | * @throws \ArangoDBClient\ClientException |
||
200 | * @throws \ArangoDBClient\Exception |
||
201 | */ |
||
202 | protected function getAllTables(array $options = []) |
||
206 | |||
207 | /** |
||
208 | * @param string $collection |
||
209 | * @return \ArangoDBClient\Collection |
||
210 | * @throws \ArangoDBClient\Exception |
||
211 | */ |
||
212 | protected function getCollection($collection) |
||
216 | |||
217 | /** |
||
218 | * Rename a collection. |
||
219 | * |
||
220 | * @param $from |
||
221 | * @param $to |
||
222 | * @return bool |
||
223 | * @throws \ArangoDBClient\Exception |
||
224 | */ |
||
225 | public function rename($from, $to) |
||
229 | |||
230 | /** |
||
231 | * Determine if the given collection exists. |
||
232 | * |
||
233 | * @param string $collection |
||
234 | * @return bool |
||
235 | * @throws \ArangoDBClient\Exception |
||
236 | */ |
||
237 | public function hasCollection(string $collection) |
||
241 | |||
242 | /** |
||
243 | * Alias for hasCollection. |
||
244 | * |
||
245 | * @param string $table |
||
246 | * @return bool |
||
247 | * @throws \ArangoDBClient\Exception |
||
248 | */ |
||
249 | public function hasTable($table) |
||
253 | |||
254 | /** |
||
255 | * Check if any document in the collection has the attribute. |
||
256 | * |
||
257 | * @param string $collection |
||
258 | * @param string $attribute |
||
259 | * @return bool |
||
260 | */ |
||
261 | public function hasAttribute($collection, $attribute) |
||
269 | |||
270 | /** |
||
271 | * Check if any document in the collection has the attribute. |
||
272 | * |
||
273 | * @param string $collection |
||
274 | * @param array $attributes |
||
275 | * @return bool |
||
276 | */ |
||
277 | public function hasAttributes($collection, $attributes) |
||
288 | |||
289 | /** |
||
290 | * Alias for hasAttribute. |
||
291 | * |
||
292 | * @param string $table |
||
293 | * @param string $column |
||
294 | * @return bool |
||
295 | */ |
||
296 | public function hasColumn($table, $column) |
||
300 | |||
301 | /** |
||
302 | * Alias for hasAttributes. |
||
303 | * |
||
304 | * @param string $table |
||
305 | * @param array $columns |
||
306 | * @return bool |
||
307 | */ |
||
308 | public function hasColumns($table, $columns) |
||
312 | |||
313 | /** |
||
314 | * get information about the collection. |
||
315 | * |
||
316 | * @param $collection |
||
317 | * @return mixed |
||
318 | */ |
||
319 | public function getCollectionInfo($collection) |
||
323 | |||
324 | /** |
||
325 | * @param string $name |
||
326 | * @param array $properties |
||
327 | * @param string $type |
||
328 | * @throws \ArangoDBClient\ClientException |
||
329 | * @throws \ArangoDBClient\Exception |
||
330 | */ |
||
331 | public function createView($name, array $properties, $type = 'arangosearch') |
||
338 | |||
339 | /** |
||
340 | * @param string $name |
||
341 | * @return mixed |
||
342 | * @throws \ArangoDBClient\Exception |
||
343 | */ |
||
344 | public function getView(string $name) |
||
348 | |||
349 | /** |
||
350 | * @param string $name |
||
351 | * @param array $properties |
||
352 | * @throws \ArangoDBClient\ClientException |
||
353 | * @throws \ArangoDBClient\Exception |
||
354 | */ |
||
355 | public function editView($name, array $properties) |
||
359 | |||
360 | /** |
||
361 | * @param string $from |
||
362 | * @param string $to |
||
363 | * @throws \ArangoDBClient\Exception |
||
364 | */ |
||
365 | public function renameView(string $from, string $to) |
||
369 | |||
370 | /** |
||
371 | * @param string $name |
||
372 | * @throws \ArangoDBClient\ClientException |
||
373 | * @throws \ArangoDBClient\Exception |
||
374 | */ |
||
375 | public function dropView(string $name) |
||
379 | |||
380 | /** |
||
381 | * Get the database connection instance. |
||
382 | * |
||
383 | * @return Connection |
||
384 | */ |
||
385 | public function getConnection() |
||
389 | |||
390 | /** |
||
391 | * Silently catch the use of unsupported builder methods. |
||
392 | * |
||
393 | * @param $method |
||
394 | * @param $args |
||
395 | * @return null |
||
396 | */ |
||
397 | public function __call($method, $args) |
||
401 | } |
||
402 |
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.