R3VoLuT1OneR /
jsonapi-resource
| 1 | <?php namespace JSONAPI\Resource\Attributes; |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Attribute used to mark class as JSON:API resource. |
||
| 5 | */ |
||
| 6 | #[\Attribute( |
||
| 7 | \Attribute::TARGET_CLASS |
||
| 8 | )] |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 9 | class Resource |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param array<string, mixed> $options |
||
| 13 | */ |
||
| 14 | public function __construct( |
||
| 15 | protected ?string $type = null, |
||
| 16 | protected string $idFetcher = 'getId', |
||
| 17 | protected array $options = [] |
||
| 18 | ) {} |
||
| 19 | |||
| 20 | public function getType(): ?string |
||
| 21 | { |
||
| 22 | return $this->type; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function getIdFetcher(): string |
||
| 26 | { |
||
| 27 | return $this->idFetcher; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return array<string, mixed> |
||
| 32 | */ |
||
| 33 | public function getOptions(): array |
||
| 34 | { |
||
| 35 | return $this->options; |
||
| 36 | } |
||
| 37 | } |