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 | private function __construct() |
|
34 | 21 | ||
35 | public static function fromMeta($meta) |
||
41 | 12 | ||
42 | public static function fromSelfLink($link) |
||
48 | |||
49 | public static function fromRelatedLink($link) |
||
55 | |||
56 | public static function fromData($data) |
||
62 | |||
63 | /** |
||
64 | * Get the data object. |
||
65 | 12 | * |
|
66 | * @return \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null |
||
67 | 12 | */ |
|
68 | public function getData() |
||
72 | |||
73 | 12 | /** |
|
74 | * Set the data object. |
||
75 | * |
||
76 | * @param \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null $data |
||
77 | 12 | */ |
|
78 | public function setData($data) |
||
82 | |||
83 | /** |
||
84 | * Build the relationship as an array. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | public function jsonSerialize() |
||
103 | |||
104 | /** |
||
105 | * Build an idenitfier array for the given resource. |
||
106 | * |
||
107 | * @param ResourceInterface $resource |
||
108 | * |
||
109 | * @return array |
||
|
|||
110 | */ |
||
111 | private function buildIdentifier(ResourceInterface $resource) |
||
118 | } |
||
119 |
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.