PHP Classes

File: application/modules/extensions/aws/Aws/Api/Parser/RestXmlParser.php

Recommend this page to a friend!
  Classes of Tran Tuan   Pretty PHP S3 Files Manager   application/modules/extensions/aws/Aws/Api/Parser/RestXmlParser.php   Download  
File: application/modules/extensions/aws/Aws/Api/Parser/RestXmlParser.php
Role: Application script
Content type: text/plain
Description: Application script
Class: Pretty PHP S3 Files Manager
Web based interface to manage files in Amazon S3
Author: By
Last change:
Date: 8 years ago
Size: 867 bytes
 

Contents

Class file image Download
<?php
namespace Aws\Api\Parser;

use
Aws\Api\StructureShape;
use
Aws\Api\Service;
use
Psr\Http\Message\ResponseInterface;

/**
 * @internal Implements REST-XML parsing (e.g., S3, CloudFront, etc...)
 */
class RestXmlParser extends AbstractRestParser
{
    use
PayloadParserTrait;

   
/** @var XmlParser */
   
private $parser;

   
/**
     * @param Service $api Service description
     * @param XmlParser $parser XML body parser
     */
   
public function __construct(Service $api, XmlParser $parser = null)
    {
       
parent::__construct($api);
       
$this->parser = $parser ?: new XmlParser();
    }

    protected function
payload(
       
ResponseInterface $response,
       
StructureShape $member,
        array &
$result
   
) {
       
$xml = $this->parseXml($response->getBody());
       
$result += $this->parser->parse($member, $xml);
    }
}