Debian Codegraph @

lib/3rdParty/composer/aws/aws-sdk-php/src/Api/Parser/RpcV2CborParser.php

raw symbols SCIP
1 <?php
2 namespace Aws\Api\Parser;
3
4 use Aws\Api\Cbor\CborDecoder;
5 use Aws\Api\Service;
6 use Aws\Api\StructureShape;
7 use Psr\Http\Message\StreamInterface;
8
9 /**
10 * Parses responses according to Smithy RPC V2 CBOR protocol standards.
11 *
12 * https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html
13 *
14 * @internal
15 */
16 final class RpcV2CborParser extends AbstractRpcV2Parser
17 {
18 /** @var string */
19 protected static string $smithyProtocol = 'rpc-v2-cbor';
20
21 /** @var CborDecoder */
22 private CborDecoder $decoder;
23
24 use RpcV2ParserTrait;
25
26 /**
27 * @param Service $api Service description
28 */
29 public function __construct(Service $api)
30 {
31 $this->decoder = new CborDecoder();
32 parent::__construct($api);
33 }
34
35 /**
36 * @param StreamInterface $stream
37 * @param StructureShape $member
38 * @param $response
39 *
40 * @return mixed
41 */
42 public function parseMemberFromStream(
43 StreamInterface $stream,
44 StructureShape $member,
45 $response
46 ): mixed
47 {
48 return $this->resolveOutputShape($member, $this->parseCbor($stream, $response));
49 }
50 }