| @@ 153-165 (lines=13) @@ | ||
| 150 | * @param ResourceInterface $object |
|
| 151 | * @return array |
|
| 152 | */ |
|
| 153 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 154 | { |
|
| 155 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 156 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 157 | if ($annotation === null) { |
|
| 158 | continue; |
|
| 159 | } |
|
| 160 | ||
| 161 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 162 | } |
|
| 163 | ||
| 164 | return $json; |
|
| 165 | } |
|
| 166 | ||
| 167 | protected function getEmptyOrResource(string $class, array $json): string |
|
| 168 | { |
|
| @@ 232-244 (lines=13) @@ | ||
| 229 | * @param ResourceInterface $object |
|
| 230 | * @return array |
|
| 231 | */ |
|
| 232 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 233 | { |
|
| 234 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 235 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 236 | if ($annotation === null) { |
|
| 237 | continue; |
|
| 238 | } |
|
| 239 | ||
| 240 | $json = $handler->extract($annotation, $object, $json); |
|
| 241 | } |
|
| 242 | ||
| 243 | return $json; |
|
| 244 | } |
|
| 245 | ||
| 246 | /** |
|
| 247 | * @param ResourceInterface $object |
|