mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-19 21:03:44 -07:00
v2: Updates
* Simplifies & beautifies everything * Introduces a new Class system. * Errors are defaulted to AWS's handler. * New function names & more efficient handling. * Should fix a majority of the errors. Please read the README for more!
This commit is contained in:
parent
ad0726e41e
commit
e6d7753dc8
1095 changed files with 45088 additions and 2911 deletions
|
@ -2,9 +2,11 @@
|
|||
namespace Aws\Api\Parser;
|
||||
|
||||
use Aws\Api\Service;
|
||||
use Aws\Api\StructureShape;
|
||||
use Aws\Result;
|
||||
use Aws\CommandInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
/**
|
||||
* @internal Parses query (XML) responses (e.g., EC2, SQS, and many others)
|
||||
|
@ -13,9 +15,6 @@ class QueryParser extends AbstractParser
|
|||
{
|
||||
use PayloadParserTrait;
|
||||
|
||||
/** @var XmlParser */
|
||||
private $xmlParser;
|
||||
|
||||
/** @var bool */
|
||||
private $honorResultWrapper;
|
||||
|
||||
|
@ -32,7 +31,7 @@ class QueryParser extends AbstractParser
|
|||
$honorResultWrapper = true
|
||||
) {
|
||||
parent::__construct($api);
|
||||
$this->xmlParser = $xmlParser ?: new XmlParser();
|
||||
$this->parser = $xmlParser ?: new XmlParser();
|
||||
$this->honorResultWrapper = $honorResultWrapper;
|
||||
}
|
||||
|
||||
|
@ -41,12 +40,21 @@ class QueryParser extends AbstractParser
|
|||
ResponseInterface $response
|
||||
) {
|
||||
$output = $this->api->getOperation($command->getName())->getOutput();
|
||||
$xml = $this->parseXml($response->getBody());
|
||||
$xml = $this->parseXml($response->getBody(), $response);
|
||||
|
||||
if ($this->honorResultWrapper && $output['resultWrapper']) {
|
||||
$xml = $xml->{$output['resultWrapper']};
|
||||
}
|
||||
|
||||
return new Result($this->xmlParser->parse($output, $xml));
|
||||
return new Result($this->parser->parse($output, $xml));
|
||||
}
|
||||
|
||||
public function parseMemberFromStream(
|
||||
StreamInterface $stream,
|
||||
StructureShape $member,
|
||||
$response
|
||||
) {
|
||||
$xml = $this->parseXml($stream, $response);
|
||||
return $this->parser->parse($member, $xml);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue