/**
* @return array<mixed>
*/
public function encode(Struct
$struct, ResponseFields
$fields): array
{ $array =
$this->serializer->
normalize($struct);
if (!\
is_array($array)) { throw new \
RuntimeException('Normalized struct must be an array'
);
} return $this->
loop($struct,
$fields,
$array);
} /**
* @param array<mixed> $array
*
* @return array<mixed>
*/
private function loop(Struct
$struct, ResponseFields
$fields, array
$array): array
{ $data =
$array;