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