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 / RestXmlParser.php

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

34 lines 1.1 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\StructureShape;
6 use Dudlewebs\WPMCS\s3\Aws\Api\Service;
7 use Dudlewebs\WPMCS\s3\Psr\Http\Message\ResponseInterface;
8 use Dudlewebs\WPMCS\s3\Psr\Http\Message\StreamInterface;
9 /**
10 * @internal Implements REST-XML parsing (e.g., S3, CloudFront, etc...)
11 */
12 class RestXmlParser extends AbstractRestParser
13 {
14 use PayloadParserTrait;
15 /**
16 * @param Service $api Service description
17 * @param XmlParser $parser XML body parser
18 */
19 public function __construct(Service $api, XmlParser $parser = null)
20 {
21 parent::__construct($api);
22 $this->parser = $parser ?: new XmlParser();
23 }
24 protected function payload(ResponseInterface $response, StructureShape $member, array &$result)
25 {
26 $result += $this->parseMemberFromStream($response->getBody(), $member, $response);
27 }
28 public function parseMemberFromStream(StreamInterface $stream, StructureShape $member, $response)
29 {
30 $xml = $this->parseXml($stream, $response);
31 return $this->parser->parse($member, $xml);
32 }
33 }
34