| @@ 174-186 (lines=13) @@ | ||
| 171 | * @param ResourceInterface $object |
|
| 172 | * @return array |
|
| 173 | */ |
|
| 174 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 175 | { |
|
| 176 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 177 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 178 | if ($annotation === null) { |
|
| 179 | continue; |
|
| 180 | } |
|
| 181 | ||
| 182 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 183 | } |
|
| 184 | ||
| 185 | return $json; |
|
| 186 | } |
|
| 187 | ||
| 188 | protected function getEmptyOrResource(string $class, array $json): string |
|
| 189 | { |
|
| @@ 253-265 (lines=13) @@ | ||
| 250 | * @param ResourceInterface $object |
|
| 251 | * @return array |
|
| 252 | */ |
|
| 253 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 254 | { |
|
| 255 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 256 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 257 | if ($annotation === null) { |
|
| 258 | continue; |
|
| 259 | } |
|
| 260 | ||
| 261 | $json = $handler->extract($annotation, $object, $json); |
|
| 262 | } |
|
| 263 | ||
| 264 | return $json; |
|
| 265 | } |
|
| 266 | ||
| 267 | /** |
|
| 268 | * @param ResourceInterface $object |
|