PHP Classes

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

Recommend this page to a friend!
  Classes of Tran Tuan   Pretty PHP S3 Files Manager   application/modules/extensions/aws/Aws/Api/ErrorParser/JsonParserTrait.php   Download  
File: application/modules/extensions/aws/Aws/Api/ErrorParser/JsonParserTrait.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: 8 years ago
Size: 682 bytes
 

Contents

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

use
Aws\Api\Parser\PayloadParserTrait;
use
Psr\Http\Message\ResponseInterface;

/**
 * Provides basic JSON error parsing functionality.
 */
trait JsonParserTrait
{
    use
PayloadParserTrait;

    private function
genericHandler(ResponseInterface $response)
    {
       
$code = (string) $response->getStatusCode();

        return [
           
'request_id' => (string) $response->getHeaderLine('x-amzn-requestid'),
           
'code' => null,
           
'message' => null,
           
'type' => $code[0] == '4' ? 'client' : 'server',
           
'parsed' => $this->parseJson($response->getBody())
        ];
    }
}