PluginProbe ʕ •ᴥ•ʔ
Transferito: WP Migration / trunk
Transferito: WP Migration vtrunk
trunk 11.4.0 12.0.0 13.1.0 14.0.0 14.0.11 14.0.7 14.1.0 14.1.1 14.1.2 14.1.3 14.1.4
transferito / vendor / aws / aws-sdk-php / src / Api / Parser / QueryParser.php
transferito / vendor / aws / aws-sdk-php / src / Api / Parser Last commit date
Exception 11 months ago AbstractParser.php 11 months ago AbstractRestParser.php 11 months ago Crc32ValidatingParser.php 11 months ago DecodingEventStreamIterator.php 11 months ago EventParsingIterator.php 11 months ago JsonParser.php 11 months ago JsonRpcParser.php 11 months ago MetadataParserTrait.php 11 months ago PayloadParserTrait.php 11 months ago QueryParser.php 11 months ago RestJsonParser.php 11 months ago RestXmlParser.php 11 months ago XmlParser.php 11 months ago
QueryParser.php
61 lines
1 <?php
2 namespace Aws\Api\Parser;
3
4 use Aws\Api\Service;
5 use Aws\Api\StructureShape;
6 use Aws\Result;
7 use Aws\CommandInterface;
8 use Psr\Http\Message\ResponseInterface;
9 use Psr\Http\Message\StreamInterface;
10
11 /**
12 * @internal Parses query (XML) responses (e.g., EC2, SQS, and many others)
13 */
14 class QueryParser extends AbstractParser
15 {
16 use PayloadParserTrait;
17
18 /** @var bool */
19 private $honorResultWrapper;
20
21 /**
22 * @param Service $api Service description
23 * @param XmlParser $xmlParser Optional XML parser
24 * @param bool $honorResultWrapper Set to false to disable the peeling
25 * back of result wrappers from the
26 * output structure.
27 */
28 public function __construct(
29 Service $api,
30 XmlParser $xmlParser = null,
31 $honorResultWrapper = true
32 ) {
33 parent::__construct($api);
34 $this->parser = $xmlParser ?: new XmlParser();
35 $this->honorResultWrapper = $honorResultWrapper;
36 }
37
38 public function __invoke(
39 CommandInterface $command,
40 ResponseInterface $response
41 ) {
42 $output = $this->api->getOperation($command->getName())->getOutput();
43 $xml = $this->parseXml($response->getBody(), $response);
44
45 if ($this->honorResultWrapper && $output['resultWrapper']) {
46 $xml = $xml->{$output['resultWrapper']};
47 }
48
49 return new Result($this->parser->parse($output, $xml));
50 }
51
52 public function parseMemberFromStream(
53 StreamInterface $stream,
54 StructureShape $member,
55 $response
56 ) {
57 $xml = $this->parseXml($stream, $response);
58 return $this->parser->parse($member, $xml);
59 }
60 }
61