| @@ 165-177 (lines=13) @@ | ||
| 162 | * @param ResourceInterface $object |
|
| 163 | * @return array |
|
| 164 | */ |
|
| 165 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 166 | { |
|
| 167 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 168 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 169 | if ($annotation === null) { |
|
| 170 | continue; |
|
| 171 | } |
|
| 172 | ||
| 173 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 174 | } |
|
| 175 | ||
| 176 | return $json; |
|
| 177 | } |
|
| 178 | ||
| 179 | protected function getEmptyOrResource(string $class, array $json): string |
|
| 180 | { |
|
| @@ 244-256 (lines=13) @@ | ||
| 241 | * @param ResourceInterface $object |
|
| 242 | * @return array |
|
| 243 | */ |
|
| 244 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 245 | { |
|
| 246 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 247 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 248 | if ($annotation === null) { |
|
| 249 | continue; |
|
| 250 | } |
|
| 251 | ||
| 252 | $json = $handler->extract($annotation, $object, $json); |
|
| 253 | } |
|
| 254 | ||
| 255 | return $json; |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * @param ResourceInterface $object |
|