Вход Регистрация
Файл: includes/library/aws/Aws/Api/Parser/JsonRpcParser.php
Строк: 41
<?php
namespace AwsApiParser;

use 
AwsApiService;
use 
AwsResult;
use 
AwsCommandInterface;
use 
PsrHttpMessageResponseInterface;

/**
 * @internal Implements JSON-RPC parsing (e.g., DynamoDB)
 */
class JsonRpcParser extends AbstractParser
{
    private 
$parser;

    
/**
     * @param Service    $api    Service description
     * @param JsonParser $parser JSON body builder
     */
    
public function __construct(Service $apiJsonParser $parser null)
    {
        
parent::__construct($api);
        
$this->parser $parser ?: new JsonParser();
    }

    public function 
__invoke(
        
CommandInterface $command,
        
ResponseInterface $response
    
) {
        
$operation $this->api->getOperation($command->getName());

        return new 
Result($this->parser->parse(
            
$operation->getOutput(),
            
json_decode($response->getBody(), true)
        ));
    }
}
Онлайн: 0
Реклама