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