| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait AttributesManipulation |
||
| 8 | { |
||
| 9 | use HasAttributes; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Convert the model instance to an array. |
||
| 13 | */ |
||
| 14 | 1 | public function toArray(): array |
|
| 15 | { |
||
| 16 | 1 | return $this->attributesToArray(); |
|
| 17 | } |
||
| 18 | |||
| 19 | 2 | public function get($key, $default = null) |
|
|
|
|||
| 20 | { |
||
| 21 | 2 | return $this->getAttribute($key); |
|
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Determine if the given attribute exists. |
||
| 26 | */ |
||
| 27 | 7 | public function offsetExists(mixed $offset): bool |
|
| 28 | { |
||
| 29 | 7 | return !is_null($this->getAttribute($offset)); |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get the value for a given offset. |
||
| 34 | */ |
||
| 35 | 5 | public function offsetGet(mixed $offset): mixed |
|
| 36 | { |
||
| 37 | 5 | return $this->getAttribute($offset); |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Set the value for a given offset. |
||
| 42 | */ |
||
| 43 | 4 | public function offsetSet(mixed $offset, mixed $value): void |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Unset the value for a given offset. |
||
| 50 | */ |
||
| 51 | 2 | public function offsetUnset(mixed $offset): void |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.