| @@ 96-108 (lines=13) @@ | ||
| 93 | * @param ResourceInterface $object |
|
| 94 | * @return array |
|
| 95 | */ |
|
| 96 | protected function hydrateApplyAnnotations(array $json, ResourceInterface $object): array |
|
| 97 | { |
|
| 98 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 99 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 100 | if ($annotation === null) { |
|
| 101 | continue; |
|
| 102 | } |
|
| 103 | ||
| 104 | $json = $handler->hydrate($annotation, $json, $object); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $json; |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * @param string $class |
|
| @@ 146-158 (lines=13) @@ | ||
| 143 | * @param ResourceInterface $object |
|
| 144 | * @return array |
|
| 145 | */ |
|
| 146 | protected function extractApplyAnnotations(ResourceInterface $object, array $json): array |
|
| 147 | { |
|
| 148 | foreach ($this->annotationHandlers as $annotationClass => $handler) { |
|
| 149 | $annotation = $this->getAnnotation($object, $annotationClass); |
|
| 150 | if ($annotation === null) { |
|
| 151 | continue; |
|
| 152 | } |
|
| 153 | ||
| 154 | $json = $handler->extract($annotation, $object, $json); |
|
| 155 | } |
|
| 156 | ||
| 157 | return $json; |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * @param ResourceInterface $object |
|