File: application/modules/extensions/aws/Aws/Api/ErrorParser/JsonRpcErrorParser.php

Recommend this page to a friend!
  Classes of Tran Tuan  >  Pretty PHP S3 Files Manager  >  application/modules/extensions/aws/Aws/Api/ErrorParser/JsonRpcErrorParser.php  >  Download  
File: application/modules/extensions/aws/Aws/Api/ErrorParser/JsonRpcErrorParser.php
Role: Application script
Content type: text/plain
Description: Application script
Class: Pretty PHP S3 Files Manager
Web based interface to manage files in Amazon S3
Author: By
Last change:
Date: 4 years ago
Size: 804 bytes
 

Contents

Class file image Download
<?php
namespace Aws\Api\ErrorParser;

use
Psr\Http\Message\ResponseInterface;

/**
 * Parsers JSON-RPC errors.
 */
class JsonRpcErrorParser
{
    use
JsonParserTrait;

    public function
__invoke(ResponseInterface $response)
    {
       
$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'])) {
           
$parts = explode('#', $data['parsed']['__type']);
           
$data['code'] = isset($parts[1]) ? $parts[1] : $parts[0];
           
$data['message'] = isset($data['parsed']['message'])
                ?
$data['parsed']['message']
                :
null;
        }

        return
$data;
    }
}


For more information send a message to info at phpclasses dot org.