| @@ 107-119 (lines=13) @@ | ||
| 104 | * @param ResourceInterface $object |
|
| 105 | * @return array |
|
| 106 | */ |
|
| 107 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 108 | { |
|
| 109 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 110 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 111 | if ($annotation === null) { |
|
| 112 | continue; |
|
| 113 | } |
|
| 114 | ||
| 115 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 116 | } |
|
| 117 | ||
| 118 | return $json; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param string $class |
|
| @@ 157-169 (lines=13) @@ | ||
| 154 | * @param ResourceInterface $object |
|
| 155 | * @return array |
|
| 156 | */ |
|
| 157 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 158 | { |
|
| 159 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 160 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 161 | if ($annotation === null) { |
|
| 162 | continue; |
|
| 163 | } |
|
| 164 | ||
| 165 | $json = $handler->extract($annotation, $object, $json); |
|
| 166 | } |
|
| 167 | ||
| 168 | return $json; |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * @param ResourceInterface $object |
|