LaravelFreelancerNL /
laravel-arangodb
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace LaravelFreelancerNL\Aranguent\Schema\Concerns; |
||
| 4 | |||
| 5 | use Illuminate\Support\Fluent; |
||
| 6 | |||
| 7 | trait Columns |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Check if any document within the table has the column. |
||
| 12 | * |
||
| 13 | * @param string|array $column |
||
| 14 | * @return Fluent |
||
| 15 | */ |
||
| 16 | public function hasColumn($column) |
||
| 17 | { |
||
| 18 | $parameters = []; |
||
| 19 | $parameters['handler'] = 'aql'; |
||
| 20 | $parameters['explanation'] = "Checking if any document within the table has the '".implode(', ', (array) $column)."' column(s)."; |
||
| 21 | $parameters['column'] = $column; |
||
| 22 | |||
| 23 | return $this->addCommand('hasAttribute', $parameters); |
||
|
0 ignored issues
–
show
|
|||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Indicate that the given attributes should be renamed. |
||
| 28 | * |
||
| 29 | * @param string $from |
||
| 30 | * @param string $to |
||
| 31 | * @return Fluent |
||
| 32 | */ |
||
| 33 | public function renameColumn($from, $to) |
||
| 34 | { |
||
| 35 | $parameters = []; |
||
| 36 | $parameters['handler'] = 'aql'; |
||
| 37 | $parameters['explanation'] = "Rename the column '$from' to '$to'."; |
||
| 38 | $parameters['from'] = $from; |
||
| 39 | $parameters['to'] = $to; |
||
| 40 | |||
| 41 | return $this->addCommand('renameAttribute', $parameters); |
||
|
0 ignored issues
–
show
It seems like
addCommand() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the Loading history...
|
|||
| 42 | } |
||
| 43 | |||
| 44 | |||
| 45 | /** |
||
| 46 | * Indicate that the given column(s) should be dropped. |
||
| 47 | * |
||
| 48 | * @param array|mixed $columns |
||
| 49 | * @return Fluent |
||
| 50 | */ |
||
| 51 | public function dropColumn($columns) |
||
| 52 | { |
||
| 53 | $columns = is_array($columns) ? $columns : func_get_args(); |
||
| 54 | |||
| 55 | $parameters = []; |
||
| 56 | $parameters['handler'] = 'aql'; |
||
| 57 | $parameters['attributes'] = $columns; |
||
| 58 | $parameters['explanation'] = 'Drop the following column(s): '.implode(',', $columns).'.'; |
||
| 59 | |||
| 60 | return $this->addCommand('dropAttribute', compact('parameters')); |
||
|
0 ignored issues
–
show
It seems like
addCommand() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the Loading history...
|
|||
| 61 | } |
||
| 62 | |||
| 63 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.