getMembers() as $name => $member) { $locationName = $member['locationName'] ?: $name; if (isset($value[$locationName])) { $target[$name] = $this->resolveOutputShape($member, $value[$locationName]); } } return $target; case 'list': $target = []; foreach ($value as $v) { $target[] = $this->resolveOutputShape($shape->getMember(), $v); } return $target; case 'map': $target = []; foreach ($value as $k => $v) { if ($v !== null) { $target[$k] = $this->resolveOutputShape($shape->getValue(), $v); } } return $target; case 'timestamp': try { $value = DateTimeResult::fromEpoch($value); } catch (\Exception $e) { trigger_error( 'Unable to parse timestamp value for ' . $shape->getName() . ': ' . $e->getMessage(), E_USER_WARNING ); } return $value; default: return $value; } } /** * Parses CBOR-encoded response data from RPC V2 CBOR services. * * @param StreamInterface $stream * @param ResponseInterface $response * * @return mixed */ protected function parseCbor( StreamInterface $stream, ResponseInterface $response ): mixed { try { $cborString = (string) $stream; return empty($cborString) ? null : $this->decoder->decode($cborString); } catch (CborException $e) { throw new ParserException( "Malformed Response: error parsing CBOR: {$e->getMessage()}", 0, $e, ['response' => $response] ); } } }