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