1 | <?php |
||
9 | class Builder |
||
10 | { |
||
11 | /** |
||
12 | * The database connection instance. |
||
13 | * |
||
14 | * @var \Illuminate\Database\Connection |
||
15 | */ |
||
16 | protected $connection; |
||
17 | |||
18 | protected $collectionHandler; |
||
19 | |||
20 | /** |
||
21 | * The schema grammar instance. |
||
22 | * |
||
23 | * @var Grammar |
||
24 | */ |
||
25 | protected $grammar; |
||
26 | |||
27 | /** |
||
28 | * The Blueprint resolver callback. |
||
29 | * |
||
30 | * @var \Closure |
||
31 | */ |
||
32 | protected $resolver; |
||
33 | |||
34 | /** |
||
35 | * Create a new database Schema manager. |
||
36 | * |
||
37 | * Builder constructor. |
||
38 | * @param Connection $connection |
||
39 | */ |
||
40 | public function __construct(Connection $connection) |
||
48 | |||
49 | /** |
||
50 | * Create a new collection on the schema. |
||
51 | * |
||
52 | * @param string $collection |
||
53 | * @param \Closure $callback |
||
54 | * @param array $config |
||
55 | * @return void |
||
56 | */ |
||
57 | public function create($collection, Closure $callback, $config = []) |
||
65 | |||
66 | /** |
||
67 | * Create a new command set with a Closure. |
||
68 | * |
||
69 | * @param string $collection |
||
70 | * @param \Closure|null $callback |
||
71 | * @return \LaravelFreelancerNL\Aranguent\Schema\Blueprint |
||
72 | */ |
||
73 | protected function createBlueprint($collection, Closure $callback = null) |
||
84 | |||
85 | protected function build(Blueprint $blueprint) |
||
89 | |||
90 | /** |
||
91 | * Set the Schema Blueprint resolver callback. |
||
92 | * |
||
93 | * @param \Closure $resolver |
||
94 | * @return void |
||
95 | */ |
||
96 | public function blueprintResolver(Closure $resolver) |
||
100 | |||
101 | /** |
||
102 | * Modify a collection's schema. |
||
103 | * |
||
104 | * @param string $collection |
||
105 | * @param \Closure $callback |
||
106 | * @return void |
||
107 | */ |
||
108 | public function collection($collection, Closure $callback) |
||
112 | |||
113 | /** |
||
114 | * Alias for collection. |
||
115 | * |
||
116 | * @param string $table |
||
117 | * @param \Closure $callback |
||
118 | * @return void |
||
119 | */ |
||
120 | public function table($table, Closure $callback) |
||
124 | |||
125 | /** |
||
126 | * Drop a collection from the schema. |
||
127 | * |
||
128 | * @param string $collection |
||
129 | * @return void |
||
130 | * @throws \ArangoDBClient\Exception |
||
131 | */ |
||
132 | public function drop($collection) |
||
136 | |||
137 | public function dropAllCollections() |
||
145 | |||
146 | /** |
||
147 | * Alias for dropAllCollections. |
||
148 | * |
||
149 | * @return void |
||
150 | */ |
||
151 | public function dropAllTables() |
||
155 | |||
156 | /** |
||
157 | * @param $collection |
||
158 | * @throws \ArangoDBClient\Exception |
||
159 | */ |
||
160 | public function dropIfExists($collection) |
||
166 | |||
167 | /** |
||
168 | * Get all of the collection names for the database. |
||
169 | * |
||
170 | * @param array $options |
||
171 | * @return array |
||
172 | * @throws \ArangoDBClient\ClientException |
||
173 | * @throws \ArangoDBClient\Exception |
||
174 | */ |
||
175 | protected function getAllCollections(array $options = []) |
||
183 | |||
184 | /** |
||
185 | * Get all of the table names for the database. |
||
186 | * Alias for getAllCollections(). |
||
187 | * |
||
188 | * @param array $options |
||
189 | * @return array |
||
190 | * @throws \ArangoDBClient\ClientException |
||
191 | * @throws \ArangoDBClient\Exception |
||
192 | */ |
||
193 | protected function getAllTables(array $options = []) |
||
197 | |||
198 | /** |
||
199 | * @param string $collection |
||
200 | * @return \ArangoDBClient\Collection |
||
201 | * @throws \ArangoDBClient\Exception |
||
202 | */ |
||
203 | protected function getCollection($collection) |
||
207 | |||
208 | /** |
||
209 | * Rename a collection. |
||
210 | * |
||
211 | * @param $from |
||
212 | * @param $to |
||
213 | * @return bool |
||
214 | * @throws \ArangoDBClient\Exception |
||
215 | */ |
||
216 | public function rename($from, $to) |
||
220 | |||
221 | /** |
||
222 | * Determine if the given collection exists. |
||
223 | * |
||
224 | * @param string $collection |
||
225 | * @return bool |
||
226 | * @throws \ArangoDBClient\Exception |
||
227 | */ |
||
228 | public function hasCollection(string $collection) |
||
232 | |||
233 | /** |
||
234 | * Alias for hasCollection. |
||
235 | * |
||
236 | * @param string $table |
||
237 | * @return bool |
||
238 | * @throws \ArangoDBClient\Exception |
||
239 | */ |
||
240 | public function hasTable($table) |
||
244 | |||
245 | /** |
||
246 | * Check if any document in the collection has the attribute. |
||
247 | * |
||
248 | * @param string $collection |
||
249 | * @param string $attribute |
||
250 | * @return bool |
||
251 | */ |
||
252 | public function hasAttribute($collection, $attribute) |
||
260 | |||
261 | /** |
||
262 | * Check if any document in the collection has the attribute. |
||
263 | * |
||
264 | * @param string $collection |
||
265 | * @param array $attributes |
||
266 | * @return bool |
||
267 | */ |
||
268 | public function hasAttributes($collection, $attributes) |
||
279 | |||
280 | /** |
||
281 | * Alias for hasAttribute. |
||
282 | * |
||
283 | * @param string $table |
||
284 | * @param string $column |
||
285 | * @return bool |
||
286 | */ |
||
287 | public function hasColumn($table, $column) |
||
291 | |||
292 | /** |
||
293 | * Alias for hasAttributes. |
||
294 | * |
||
295 | * @param string $table |
||
296 | * @param array $columns |
||
297 | * @return bool |
||
298 | */ |
||
299 | public function hasColumns($table, $columns) |
||
303 | |||
304 | /** |
||
305 | * get information about the collection. |
||
306 | * |
||
307 | * @param $collection |
||
308 | * @return mixed |
||
309 | */ |
||
310 | public function getCollectionInfo($collection) |
||
314 | |||
315 | /** |
||
316 | * Get the database connection instance. |
||
317 | * |
||
318 | * @return Connection |
||
319 | */ |
||
320 | public function getConnection() |
||
324 | |||
325 | /** |
||
326 | * Silently catch the use of unsupported builder methods. |
||
327 | * |
||
328 | * @param $method |
||
329 | * @param $args |
||
330 | * @return null |
||
331 | */ |
||
332 | public function __call($method, $args) |
||
336 | } |
||
337 |
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.