@@ 241-253 (lines=13) @@ | ||
238 | * @param ResourceInterface $object |
|
239 | * @return array |
|
240 | */ |
|
241 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
242 | { |
|
243 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
244 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
245 | if ($annotation === null) { |
|
246 | continue; |
|
247 | } |
|
248 | ||
249 | $json = $handler->hydrate($annotation, $json, $object); |
|
250 | } |
|
251 | ||
252 | return $json; |
|
253 | } |
|
254 | ||
255 | /** |
|
256 | * Ensure all properties expected by resource are available. |
|
@@ 329-341 (lines=13) @@ | ||
326 | * @param ResourceInterface $object |
|
327 | * @return array |
|
328 | */ |
|
329 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
330 | { |
|
331 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
332 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
333 | if ($annotation === null) { |
|
334 | continue; |
|
335 | } |
|
336 | ||
337 | $json = $handler->extract($annotation, $object, $json); |
|
338 | } |
|
339 | ||
340 | return $json; |
|
341 | } |
|
342 | ||
343 | /** |
|
344 | * @param ResourceInterface $object |