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 | 6 | private function __construct() |
|
34 | |||
35 | public static function fromMeta($meta) |
||
42 | |||
43 | public static function fromSelfLink($link) |
||
50 | |||
51 | public static function fromRelatedLink($link) |
||
58 | |||
59 | 6 | public static function fromData($data) |
|
66 | |||
67 | /** |
||
68 | * Get the data object. |
||
69 | * |
||
70 | * @return \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null |
||
71 | */ |
||
72 | public function getData() |
||
76 | |||
77 | /** |
||
78 | * Set the data object. |
||
79 | * |
||
80 | * @param \Tobscure\JsonApi\ResourceInterface|\Tobscure\JsonApi\ResourceInterface[]|null $data |
||
81 | */ |
||
82 | public function setData($data) |
||
86 | |||
87 | /** |
||
88 | * Build the relationship as an array. |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | 3 | public function jsonSerialize() |
|
107 | |||
108 | /** |
||
109 | * Build an idenitfier array for the given resource. |
||
110 | * |
||
111 | * @param ResourceInterface $resource |
||
112 | * |
||
113 | * @return array |
||
|
|||
114 | */ |
||
115 | 3 | private function buildIdentifier(ResourceInterface $resource) |
|
122 | } |
||
123 |
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.