1 | <?php |
||
16 | class Relationship implements JsonSerializable |
||
17 | { |
||
18 | use LinksTrait, SelfLinkTrait, RelatedLinkTrait, PaginationLinksTrait, MetaTrait; |
||
19 | |||
20 | private $data; |
||
21 | |||
22 | 6 | private function __construct() |
|
25 | |||
26 | public static function fromMeta($meta) |
||
27 | { |
||
28 | $r = new self; |
||
29 | $r->setMeta($meta); |
||
30 | |||
31 | return $r; |
||
32 | } |
||
33 | |||
34 | public static function fromSelfLink($link) |
||
35 | { |
||
36 | $r = new self; |
||
37 | $r->setSelfLink($link); |
||
38 | |||
39 | return $r; |
||
40 | } |
||
41 | |||
42 | public static function fromRelatedLink($link) |
||
43 | { |
||
44 | $r = new self; |
||
45 | $r->setRelatedLink($link); |
||
46 | |||
47 | return $r; |
||
48 | } |
||
49 | |||
50 | 6 | public static function fromData($data) |
|
51 | { |
||
52 | 6 | $r = new self; |
|
53 | 6 | $r->setData($data); |
|
54 | |||
55 | 6 | return $r; |
|
56 | } |
||
57 | |||
58 | public function getData() |
||
62 | |||
63 | 6 | public function setData($data) |
|
64 | { |
||
65 | 6 | $this->data = $data; |
|
66 | 6 | } |
|
67 | |||
68 | 3 | public function jsonSerialize() |
|
83 | |||
84 | 3 | private function buildIdentifier(ResourceInterface $resource) |
|
91 | } |
||
92 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.