PluginProbe
Media Cloud Sync / 1.2.3
Media Cloud Sync v1.2.3
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / s3 / Aws / Api / Parser / QueryParser.php

QueryParser.php in Media Cloud Sync 1.2.3, at includes/sdk/s3/Aws/Api/Parser/QueryParser.php

47 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\Api\Parser;
4
5 use Dudlewebs\WPMCS\s3\Aws\Api\Service;
6 use Dudlewebs\WPMCS\s3\Aws\Api\StructureShape;
7 use Dudlewebs\WPMCS\s3\Aws\Result;
8 use Dudlewebs\WPMCS\s3\Aws\CommandInterface;
9 use Dudlewebs\WPMCS\s3\Psr\Http\Message\ResponseInterface;
10 use Dudlewebs\WPMCS\s3\Psr\Http\Message\StreamInterface;
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 /** @var bool */
18 private $honorResultWrapper;
19 /**
20 * @param Service $api Service description
21 * @param XmlParser $xmlParser Optional XML parser
22 * @param bool $honorResultWrapper Set to false to disable the peeling
23 * back of result wrappers from the
24 * output structure.
25 */
26 public function __construct(Service $api, XmlParser $xmlParser = null, $honorResultWrapper = \true)
27 {
28 parent::__construct($api);
29 $this->parser = $xmlParser ?: new XmlParser();
30 $this->honorResultWrapper = $honorResultWrapper;
31 }
32 public function __invoke(CommandInterface $command, ResponseInterface $response)
33 {
34 $output = $this->api->getOperation($command->getName())->getOutput();
35 $xml = $this->parseXml($response->getBody(), $response);
36 if ($this->honorResultWrapper && $output['resultWrapper']) {
37 $xml = $xml->{$output['resultWrapper']};
38 }
39 return new Result($this->parser->parse($output, $xml));
40 }
41 public function parseMemberFromStream(StreamInterface $stream, StructureShape $member, $response)
42 {
43 $xml = $this->parseXml($stream, $response);
44 return $this->parser->parse($member, $xml);
45 }
46 }
47