| Total Complexity | 7 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class CollectionObjectTransformer extends SerializerTransformer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param ResponseInterface|Response $response |
||
| 14 | * |
||
| 15 | * {@inheritdoc} |
||
| 16 | */ |
||
| 17 | 5 | public function transform(ResponseInterface $response) |
|
| 18 | { |
||
| 19 | 5 | $data = $response->getData(); |
|
| 20 | |||
| 21 | 5 | foreach ($data['data'] as $k => $object) { |
|
| 22 | 5 | $data['data'][$k] = $this->serializer->deserialize( |
|
| 23 | 5 | json_encode($object), |
|
| 24 | 5 | $this->class, |
|
| 25 | 5 | 'json', |
|
| 26 | 5 | $this->context |
|
|
|
|||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | 5 | $data = new ContentCollection($data); |
|
| 31 | 5 | $response->setData($data); |
|
| 32 | 5 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @param ResponseInterface|Response $response |
||
| 36 | * |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | 35 | public function supports(ResponseInterface $response): bool |
|
| 49 | ); |
||
| 50 | } |
||
| 51 | } |