@@ 169-181 (lines=13) @@ | ||
166 | * @param ResourceInterface $object |
|
167 | * @return array |
|
168 | */ |
|
169 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
170 | { |
|
171 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
172 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
173 | if ($annotation === null) { |
|
174 | continue; |
|
175 | } |
|
176 | ||
177 | $json = $handler->hydrate($annotation, $json, $object); |
|
178 | } |
|
179 | ||
180 | return $json; |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * Ensure all properties expected by resource are available |
|
@@ 291-303 (lines=13) @@ | ||
288 | * @param ResourceInterface $object |
|
289 | * @return array |
|
290 | */ |
|
291 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
292 | { |
|
293 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
294 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
295 | if ($annotation === null) { |
|
296 | continue; |
|
297 | } |
|
298 | ||
299 | $json = $handler->extract($annotation, $object, $json); |
|
300 | } |
|
301 | ||
302 | return $json; |
|
303 | } |
|
304 | ||
305 | /** |
|
306 | * @param ResourceInterface $object |