Total Complexity | 10 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 4 | ||
Bugs | 2 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
17 | trait MutatorTrait |
||
18 | { |
||
19 | 5 | public function __set($index, $value) |
|
20 | { |
||
21 | 5 | return $this->set($index, $value); |
|
22 | } |
||
23 | |||
24 | 18 | public function set(string $index, mixed $value): static |
|
25 | { |
||
26 | 18 | $this->data[$index] = $value; |
|
27 | 18 | return $this; |
|
28 | } |
||
29 | |||
30 | 1 | public function bind(string $index, mixed &$variable): static |
|
31 | { |
||
32 | 1 | $this->data[$index] =& $variable; |
|
33 | 1 | return $this; |
|
34 | } |
||
35 | |||
36 | 1 | public function upsert(string $index, mixed $value): static |
|
39 | } |
||
40 | |||
41 | 1 | public function pull(string $index, mixed $default = null): mixed |
|
42 | { |
||
43 | 1 | $value = $this->get($index, $default); |
|
44 | 1 | unset($this->data[$index]); |
|
45 | 1 | return $value; |
|
46 | } |
||
47 | |||
48 | 18 | public function import(array $array): static |
|
54 | } |
||
55 | |||
56 | 3 | public function delete(string $index): static |
|
60 | } |
||
61 | |||
62 | 1 | public function clear(): static |
|
66 | } |
||
67 | } |
||
68 |