Submit
Path:
~
/
/
proc
/
self
/
root
/
opt
/
psa
/
admin
/
plib
/
modules
/
letsencrypt
/
vendor
/
aws
/
aws-sdk-php
/
src
/
Api
/
ErrorParser
/
File Content:
JsonRpcErrorParser.php
<?php namespace PleskLetsEncrypt\Aws\Api\ErrorParser; use PleskLetsEncrypt\Aws\Api\Parser\JsonParser; use PleskLetsEncrypt\Aws\Api\Service; use PleskLetsEncrypt\Aws\CommandInterface; use Psr\Http\Message\ResponseInterface; /** * Parsers JSON-RPC errors. */ class JsonRpcErrorParser extends AbstractErrorParser { use JsonParserTrait; private $parser; public function __construct(?Service $api = null, ?JsonParser $parser = null) { parent::__construct($api); $this->parser = $parser ?: new JsonParser(); } public function __invoke(ResponseInterface $response, ?CommandInterface $command = null) { $data = $this->genericHandler($response); // Make the casing consistent across services. if ($data['parsed']) { $data['parsed'] = \array_change_key_case($data['parsed']); } if (isset($data['parsed']['__type'])) { if (!isset($data['code'])) { $parts = \explode('#', $data['parsed']['__type']); $data['code'] = isset($parts[1]) ? $parts[1] : $parts[0]; } $data['message'] = isset($data['parsed']['message']) ? $data['parsed']['message'] : null; } $this->populateShape($data, $response, $command); return $data; } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
AbstractErrorParser.php
2863 bytes
0644
JsonParserTrait.php
1505 bytes
0644
JsonRpcErrorParser.php
1304 bytes
0644
RestJsonErrorParser.php
1623 bytes
0644
XmlErrorParser.php
3125 bytes
0644
N4ST4R_ID | Naxtarrr