1 | <?php |
||
8 | trait HasDynamicMutators |
||
9 | { |
||
10 | /** |
||
11 | * Registered mutation handler. |
||
12 | * |
||
13 | * @var MutationHandlerInterface[] |
||
14 | */ |
||
15 | private static $mutation_handlers = []; |
||
16 | |||
17 | /** |
||
18 | * Set attribute. |
||
19 | * |
||
20 | * @param string $name |
||
21 | * @param mixed $value |
||
22 | * |
||
23 | * @return self|null |
||
24 | */ |
||
25 | public function setAttribute($name, $value): ?self |
||
40 | |||
41 | /** |
||
42 | * Get attribute. |
||
43 | * |
||
44 | * @param mixed $name |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | public function getAttribute($name) |
||
59 | |||
60 | /** |
||
61 | * Register a mutation handler. |
||
62 | * |
||
63 | * @param MutationHandlerInterface $handler |
||
64 | */ |
||
65 | public static function registerMutationHandler(MutationHandlerInterface $handler) |
||
69 | |||
70 | /** |
||
71 | * Magic call method. |
||
72 | * |
||
73 | * @param $name |
||
74 | * @param $arguments |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function __call($name, $arguments) |
||
92 | } |
||
93 |