| @@ 125-137 (lines=13) @@ | ||
| 122 | * @param ResourceInterface $object |
|
| 123 | * @return array |
|
| 124 | */ |
|
| 125 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 126 | { |
|
| 127 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 128 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 129 | if ($annotation === null) { |
|
| 130 | continue; |
|
| 131 | } |
|
| 132 | ||
| 133 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 134 | } |
|
| 135 | ||
| 136 | return $json; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * @param string $class |
|
| @@ 175-187 (lines=13) @@ | ||
| 172 | * @param ResourceInterface $object |
|
| 173 | * @return array |
|
| 174 | */ |
|
| 175 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 176 | { |
|
| 177 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 178 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 179 | if ($annotation === null) { |
|
| 180 | continue; |
|
| 181 | } |
|
| 182 | ||
| 183 | $json = $handler->extract($annotation, $object, $json); |
|
| 184 | } |
|
| 185 | ||
| 186 | return $json; |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * @param ResourceInterface $object |
|