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:
Devang Srivastava 2020-09-28 15:32:51 +05:30
commit e6d7753dc8
1095 changed files with 45088 additions and 2911 deletions

View file

@ -1,10 +1,12 @@
<?php
namespace Aws\Api\Parser;
use Aws\Api\StructureShape;
use Aws\Api\Service;
use Aws\Result;
use Aws\CommandInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* @internal Implements JSON-RPC parsing (e.g., DynamoDB)
@ -13,8 +15,6 @@ class JsonRpcParser extends AbstractParser
{
use PayloadParserTrait;
private $parser;
/**
* @param Service $api Service description
* @param JsonParser $parser JSON body builder
@ -32,11 +32,20 @@ class JsonRpcParser extends AbstractParser
$operation = $this->api->getOperation($command->getName());
$result = null === $operation['output']
? null
: $this->parser->parse(
: $this->parseMemberFromStream(
$response->getBody(),
$operation->getOutput(),
$this->parseJson($response->getBody())
$response
);
return new Result($result ?: []);
}
public function parseMemberFromStream(
StreamInterface $stream,
StructureShape $member,
$response
) {
return $this->parser->parse($member, $this->parseJson($stream, $response));
}
}