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