| Total Complexity | 6 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait HasAttributesTrait |
||
| 6 | { |
||
| 7 | /** @var array $attributes */ |
||
| 8 | private $attributes = []; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param $key |
||
| 12 | * @return mixed|null |
||
| 13 | */ |
||
| 14 | 2 | public function getAttribute(string $key, $default = null) |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $key |
||
| 21 | * @param $value |
||
| 22 | */ |
||
| 23 | 1 | public function setAttribute(string $key, $value): void |
|
| 24 | { |
||
| 25 | 1 | $this->attributes[$key] = $value; |
|
| 26 | 1 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @param array $attributes |
||
| 30 | */ |
||
| 31 | 8 | public function setAttributes(array $attributes): void |
|
| 32 | { |
||
| 33 | 8 | $this->attributes = $attributes; |
|
| 34 | 8 | } |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @return array |
||
| 38 | */ |
||
| 39 | 2 | public function getAttributes(): array |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $key |
||
| 46 | * @return bool |
||
| 47 | */ |
||
| 48 | 1 | public function hasAttribute(string $key): bool |
|
| 51 | } |
||
| 52 | } |
||
| 53 |