1 | <?php namespace JSONAPI\Resource\Attributes; |
||
2 | |||
3 | use ReflectionMethod; |
||
4 | use ReflectionProperty; |
||
5 | use ReflectionException; |
||
6 | |||
7 | abstract class AbstractFieldAttribute |
||
8 | { |
||
9 | /** |
||
10 | * Attribute constructor. |
||
11 | * @param string|null $key Field key to be used in attributes\relationships representation. |
||
12 | * @param mixed|callable|null $value Field value or function that may work as getter. |
||
13 | * Can be used for class target attributes that don't property or method |
||
14 | * to return the value. |
||
15 | * @param array<string, mixed> $options Any other extra options that can be used by plugins. |
||
16 | */ |
||
17 | public function __construct( |
||
18 | protected ?string $key = null, |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
19 | protected mixed $value = null, |
||
20 | protected array $options = [] |
||
21 | ) {} |
||
22 | |||
23 | public function getKey(): ?string |
||
24 | { |
||
25 | return $this->key; |
||
26 | } |
||
27 | |||
28 | public function getValue(): mixed |
||
29 | { |
||
30 | return $this->value; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return array<string, mixed> |
||
35 | */ |
||
36 | public function getOptions(): array |
||
37 | { |
||
38 | return $this->options; |
||
39 | } |
||
40 | } |