1 | <?php |
||
28 | final class Linker implements LinkerInterface |
||
29 | { |
||
30 | /** @var Reader */ |
||
31 | private $reader; |
||
32 | |||
33 | /** @var InvokerInterface */ |
||
34 | private $invoker; |
||
35 | |||
36 | /** @var FactoryInterface */ |
||
37 | private $factory; |
||
38 | |||
39 | /** |
||
40 | 54 | * memory cache for linker |
|
41 | * |
||
42 | * @var array<string, mixed> |
||
43 | */ |
||
44 | private $cache = []; |
||
45 | 54 | ||
46 | 54 | public function __construct( |
|
55 | |||
56 | 10 | /** |
|
57 | * {@inheritdoc} |
||
58 | 10 | */ |
|
59 | 10 | public function invoke(AbstractRequest $request) |
|
65 | |||
66 | 8 | /** |
|
67 | * @throws LinkQueryException |
||
68 | * @throws LinkRelException |
||
69 | */ |
||
70 | private function invokeRecursive(AbstractRequest $request): ResourceObject |
||
86 | |||
87 | /** |
||
88 | * How next linked resource treated (add ? replace ?) |
||
89 | 4 | * |
|
90 | * @param mixed|ResourceObject $nextResource |
||
91 | */ |
||
92 | private function nextLink(LinkType $link, ResourceObject $ro, $nextResource): ResourceObject |
||
113 | 5 | ||
114 | /** |
||
115 | * Annotation link |
||
116 | * |
||
117 | * @throws MethodException |
||
118 | * @throws LinkRelException |
||
119 | * @throws Exception\LinkQueryException |
||
120 | */ |
||
121 | private function annotationLink(LinkType $link, ResourceObject $current, AbstractRequest $request): ResourceObject |
||
137 | |||
138 | 4 | /** |
|
139 | * Annotation link (new, self) |
||
140 | * |
||
141 | 1 | * @param Link[] $annotations |
|
142 | * |
||
143 | * @throws UriException |
||
144 | * @throws MethodException |
||
145 | * @throws Exception\LinkQueryException |
||
146 | * @throws Exception\LinkRelException |
||
147 | */ |
||
148 | private function annotationRel(array $annotations, LinkType $link, ResourceObject $current): ResourceObject |
||
167 | |||
168 | /** |
||
169 | 4 | * Link annotation crawl |
|
170 | * |
||
171 | 4 | * @param array<object> $annotations |
|
172 | * |
||
173 | 4 | * @throws MethodException |
|
174 | 3 | */ |
|
175 | private function annotationCrawl(array $annotations, LinkType $link, ResourceObject $current): ResourceObject |
||
189 | |||
190 | 4 | /** |
|
191 | * @param array<object> $annotations |
||
192 | 4 | * @param array<string, mixed> $body |
|
193 | 4 | * |
|
194 | 4 | * @throws LinkQueryException |
|
195 | 4 | * @throws MethodException |
|
196 | 4 | * @throws LinkRelException |
|
197 | 4 | * @throws UriException |
|
198 | * |
||
199 | 4 | * @param-out array $body |
|
200 | */ |
||
201 | private function crawl(array $annotations, LinkType $link, array &$body): void |
||
224 | 4 | ||
225 | /** |
||
226 | * @return array<mixed> |
||
227 | */ |
||
228 | private function getResponseBody(Request $request): ?array |
||
235 | |||
236 | /** |
||
237 | * @param mixed $value |
||
238 | */ |
||
239 | private function isList($value): bool |
||
253 | |||
254 | /** |
||
255 | * @param array<int, int|string> $keys |
||
256 | * @param array<array<mixed>> $list |
||
257 | */ |
||
258 | private function isMultiColumnMultiRowList(array $keys, array $list): bool |
||
272 | |||
273 | /** |
||
274 | * @param array<int|string, mixed> $value |
||
275 | * @param mixed $firstRow |
||
276 | */ |
||
277 | private function isMultiColumnList(array $value, $firstRow): bool |
||
281 | |||
282 | /** |
||
283 | * @param array<int|string, mixed> $value |
||
284 | * @param list<array-key> $keys |
||
285 | * @param array<mixed, mixed> $list |
||
286 | */ |
||
287 | private function isSingleColumnList(array $value, array $keys, array $list): bool |
||
291 | } |
||
292 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.