1 | <?php |
||
7 | class Resource implements ResourceInterface, EmbeddableInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var Explorer |
||
11 | */ |
||
12 | private $explorer; |
||
13 | |||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $properties; |
||
18 | |||
19 | /** |
||
20 | * @var LinkInterface[] |
||
21 | */ |
||
22 | private $links = []; |
||
23 | |||
24 | /** |
||
25 | * @var ResourceInterface[] |
||
26 | */ |
||
27 | private $embedded = []; |
||
28 | |||
29 | /** |
||
30 | * @param Explorer $explorer |
||
31 | * @param array $properties |
||
32 | */ |
||
33 | 5 | public function __construct(Explorer $explorer, array $properties) |
|
38 | |||
39 | /** |
||
40 | * @param string $name |
||
41 | * @return LinkInterface |
||
42 | * @throws NotFoundException |
||
43 | */ |
||
44 | 4 | public function getLink($name) |
|
51 | |||
52 | /** |
||
53 | * @param string $name |
||
54 | * @param LinkInterface $link |
||
55 | */ |
||
56 | 5 | public function addLink($name, LinkInterface $link) |
|
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * @return bool |
||
64 | */ |
||
65 | 4 | public function hasLink($name) |
|
69 | |||
70 | /** |
||
71 | * @param string $name |
||
72 | * @param ResourceInterface $resource |
||
73 | */ |
||
74 | 4 | public function addEmbedded($name, ResourceInterface $resource) |
|
78 | |||
79 | /** |
||
80 | * @param string $name |
||
81 | * @return ResourceInterface |
||
82 | * @throws NotFoundException |
||
83 | */ |
||
84 | 1 | public function getEmbedded($name) |
|
91 | |||
92 | /** |
||
93 | * @param string $name |
||
94 | * @return bool |
||
95 | */ |
||
96 | 4 | public function hasEmbedded($name) |
|
100 | |||
101 | /** |
||
102 | * @return array |
||
103 | */ |
||
104 | 5 | public function getData() |
|
115 | } |
||
116 |