![]() Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : fdshops ( 1003) PHP Version : 8.2.21 Disable Function : NONE Directory : /home/fdshops/public_html/vendor/aws/aws-sdk-php/src/Api/Parser/ |
<?php namespace Aws\Api\Parser; use Aws\Api\Parser\Exception\ParserException; use Psr\Http\Message\ResponseInterface; trait PayloadParserTrait { /** * @param string $json * * @throws ParserException * * @return array */ private function parseJson($json, $response) { $jsonPayload = json_decode($json, true); if (JSON_ERROR_NONE !== json_last_error()) { throw new ParserException( 'Error parsing JSON: ' . json_last_error_msg(), 0, null, ['response' => $response] ); } return $jsonPayload; } /** * @param string $xml * * @throws ParserException * * @return \SimpleXMLElement */ protected function parseXml($xml, $response) { $priorSetting = libxml_use_internal_errors(true); try { libxml_clear_errors(); $xmlPayload = new \SimpleXMLElement($xml); if ($error = libxml_get_last_error()) { throw new \RuntimeException($error->message); } } catch (\Exception $e) { throw new ParserException( "Error parsing XML: {$e->getMessage()}", 0, $e, ['response' => $response] ); } finally { libxml_use_internal_errors($priorSetting); } return $xmlPayload; } }