| @@ 151-163 (lines=13) @@ | ||
| 148 | * @param ResourceInterface $object |
|
| 149 | * @return array |
|
| 150 | */ |
|
| 151 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 152 | { |
|
| 153 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 154 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 155 | if ($annotation === null) { |
|
| 156 | continue; |
|
| 157 | } |
|
| 158 | ||
| 159 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 160 | } |
|
| 161 | ||
| 162 | return $json; |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * @param string $class |
|
| @@ 201-213 (lines=13) @@ | ||
| 198 | * @param ResourceInterface $object |
|
| 199 | * @return array |
|
| 200 | */ |
|
| 201 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 202 | { |
|
| 203 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 204 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 205 | if ($annotation === null) { |
|
| 206 | continue; |
|
| 207 | } |
|
| 208 | ||
| 209 | $json = $handler->extract($annotation, $object, $json); |
|
| 210 | } |
|
| 211 | ||
| 212 | return $json; |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * @param ResourceInterface $object |
|