R3VoLuT1OneR /
jsonapi-resource
| 1 | <?php |
||
| 2 | |||
| 3 | use JSONAPI\Resource\Attributes as JSONAPI; |
||
| 4 | |||
| 5 | #[JSONAPI\Resource('people')] |
||
| 6 | class People |
||
| 7 | { |
||
| 8 | public function __construct( |
||
| 9 | protected int $id, |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 10 | protected string $name, |
||
| 11 | protected int $age |
||
| 12 | ) {} |
||
| 13 | |||
| 14 | public function getId(): int |
||
| 15 | { |
||
| 16 | return $this->id; |
||
| 17 | } |
||
| 18 | |||
| 19 | #[JSONAPI\Attribute('name')] |
||
| 20 | public function getName(): string |
||
| 21 | { |
||
| 22 | return $this->name; |
||
| 23 | } |
||
| 24 | |||
| 25 | #[JSONAPI\Attribute('name')] |
||
| 26 | public function getAge(): int |
||
| 27 | { |
||
| 28 | return $this->age; |
||
| 29 | } |
||
| 30 | } |