| @@ 119-131 (lines=13) @@ | ||
| 116 | * @param ResourceInterface $object |
|
| 117 | * @return array |
|
| 118 | */ |
|
| 119 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 120 | { |
|
| 121 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 122 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 123 | if ($annotation === null) { |
|
| 124 | continue; |
|
| 125 | } |
|
| 126 | ||
| 127 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 128 | } |
|
| 129 | ||
| 130 | return $json; |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * @param string $class |
|
| @@ 169-181 (lines=13) @@ | ||
| 166 | * @param ResourceInterface $object |
|
| 167 | * @return array |
|
| 168 | */ |
|
| 169 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 170 | { |
|
| 171 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 172 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 173 | if ($annotation === null) { |
|
| 174 | continue; |
|
| 175 | } |
|
| 176 | ||
| 177 | $json = $handler->extract($annotation, $object, $json); |
|
| 178 | } |
|
| 179 | ||
| 180 | return $json; |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * @param ResourceInterface $object |
|