File: application/modules/extensions/aws/Aws/Api/Serializer/RestJsonSerializer.php

Recommend this page to a friend!
  Classes of Tran Tuan  >  Pretty PHP S3 Files Manager  >  application/modules/extensions/aws/Aws/Api/Serializer/RestJsonSerializer.php  >  Download  
File: application/modules/extensions/aws/Aws/Api/Serializer/RestJsonSerializer.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: 1,064 bytes
 

Contents

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

use
Aws\Api\Service;
use
Aws\Api\StructureShape;

/**
 * Serializes requests for the REST-JSON protocol.
 * @internal
 */
class RestJsonSerializer extends RestSerializer
{
   
/** @var JsonBody */
   
private $jsonFormatter;

   
/** @var string */
   
private $contentType;

   
/**
     * @param Service $api Service API description
     * @param string $endpoint Endpoint to connect to
     * @param JsonBody $jsonFormatter Optional JSON formatter to use
     */
   
public function __construct(
       
Service $api,
       
$endpoint,
       
JsonBody $jsonFormatter = null
   
) {
       
parent::__construct($api, $endpoint);
       
$this->contentType = JsonBody::getContentType($api);
       
$this->jsonFormatter = $jsonFormatter ?: new JsonBody($api);
    }

    protected function
payload(StructureShape $member, array $value, array &$opts)
    {
       
$opts['headers']['Content-Type'] = $this->contentType;
       
$opts['body'] = (string) $this->jsonFormatter->build($member, $value);
    }
}


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