vendor/aws/aws-sdk-php/src/Api/Serializer/RestXmlSerializer.php line 25

Open in your IDE?
  1. <?php
  2. namespace Aws\Api\Serializer;
  3. use Aws\Api\StructureShape;
  4. use Aws\Api\Service;
  5. /**
  6.  * @internal
  7.  */
  8. class RestXmlSerializer extends RestSerializer
  9. {
  10.     /** @var XmlBody */
  11.     private $xmlBody;
  12.     /**
  13.      * @param Service $api      Service API description
  14.      * @param string  $endpoint Endpoint to connect to
  15.      * @param XmlBody $xmlBody  Optional XML formatter to use
  16.      */
  17.     public function __construct(
  18.         Service $api,
  19.         $endpoint,
  20.         XmlBody $xmlBody null
  21.     ) {
  22.         parent::__construct($api$endpoint);
  23.         $this->xmlBody $xmlBody ?: new XmlBody($api);
  24.     }
  25.     protected function payload(StructureShape $member, array $value, array &$opts)
  26.     {
  27.         $opts['headers']['Content-Type'] = 'application/xml';
  28.         $opts['body'] = (string) $this->xmlBody->build($member$value);
  29.     }
  30. }