1 | <?php |
||
16 | class Relationship implements JsonSerializable |
||
17 | { |
||
18 | use LinksTrait; |
||
19 | use SelfLinkTrait; |
||
20 | use RelatedLinkTrait; |
||
21 | use PaginationLinksTrait; |
||
22 | use MetaTrait; |
||
23 | |||
24 | /** |
||
25 | * The data object. |
||
26 | * |
||
27 | * @var \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null |
||
28 | */ |
||
29 | protected $data; |
||
30 | |||
31 | 21 | /** |
|
32 | * Create a new relationship. |
||
33 | 21 | * |
|
34 | 21 | * @param \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null $data |
|
35 | */ |
||
36 | public function __construct($data = null) |
||
40 | |||
41 | 12 | /** |
|
42 | * Get the data object. |
||
43 | 12 | * |
|
44 | * @return \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null |
||
45 | */ |
||
46 | public function getData() |
||
50 | |||
51 | /** |
||
52 | * Set the data object. |
||
53 | * |
||
54 | * @param \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null $data |
||
55 | */ |
||
56 | public function setData($data) |
||
60 | |||
61 | /** |
||
62 | * Build the relationship as an array. |
||
63 | * |
||
64 | * @return array |
||
65 | 12 | */ |
|
66 | public function jsonSerialize() |
||
81 | 12 | ||
82 | /** |
||
83 | * Build an idenitfier array for the given resource. |
||
84 | * |
||
85 | * @param ResourceInterface $resource |
||
86 | * |
||
87 | * @return array |
||
|
|||
88 | */ |
||
89 | private function buildIdentifier(ResourceInterface $resource) |
||
96 | } |
||
97 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.