@@ 163-175 (lines=13) @@ | ||
160 | * @param ResourceInterface $object |
|
161 | * @return array |
|
162 | */ |
|
163 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
164 | { |
|
165 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
166 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
167 | if ($annotation === null) { |
|
168 | continue; |
|
169 | } |
|
170 | ||
171 | $json = $handler->hydrate($annotation, $json, $object); |
|
172 | } |
|
173 | ||
174 | return $json; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * Ensure all properties expected by resource are available |
|
@@ 285-297 (lines=13) @@ | ||
282 | * @param ResourceInterface $object |
|
283 | * @return array |
|
284 | */ |
|
285 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
286 | { |
|
287 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
288 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
289 | if ($annotation === null) { |
|
290 | continue; |
|
291 | } |
|
292 | ||
293 | $json = $handler->extract($annotation, $object, $json); |
|
294 | } |
|
295 | ||
296 | return $json; |
|
297 | } |
|
298 | ||
299 | /** |
|
300 | * @param ResourceInterface $object |