1 | <?php |
||
10 | trait AttributesTrait |
||
11 | { |
||
12 | /** |
||
13 | * @var array Loaded attributes |
||
14 | */ |
||
15 | private $attributes = []; |
||
16 | |||
17 | /** |
||
18 | * Set attribute defined by key |
||
19 | */ |
||
20 | 2 | public function setAttribute(string $key, $value): self |
|
25 | |||
26 | /** |
||
27 | * Get attribute definied by key, returning default if attribute is not set |
||
28 | * |
||
29 | * @return mixed |
||
30 | */ |
||
31 | 2 | public function getAttribute(string $key, $default = '') |
|
35 | |||
36 | /** |
||
37 | * Get all loaded attributes |
||
38 | */ |
||
39 | 6 | public function getAttributes(): array |
|
43 | |||
44 | /** |
||
45 | * Clear all attributes |
||
46 | */ |
||
47 | 9 | public function clearAttributes(): self |
|
52 | } |
||
53 |