src/Api/Service.php
public static function createSerializer(Service $api, $endpoint)
    {
        static $mapping = [
            'json'      => 'Aws\Api\Serializer\JsonRpcSerializer',
            'query'     => 'Aws\Api\Serializer\QuerySerializer',
            'rest-json' => 'Aws\Api\Serializer\RestJsonSerializer',
            'rest-xml'  => 'Aws\Api\Serializer\RestXmlSerializer'
        ];

        $proto = $api->getProtocol();

        if (isset($mapping[$proto])) {
            return new $mapping[$proto]($api, $endpoint);
        }

        if ($proto == 'ec2') {
            return new QuerySerializer($api, $endpoint, new Ec2ParamBuilder());
        }

        throw new \UnexpectedValueException(
            'Unknown protocol: ' . $api->getProtocol()
        );
    }
public static function createSerializer(Service $api, $endpoint)
    {
        static $mapping = [
            'json'      => 'Aws\Api\Serializer\JsonRpcSerializer',
            'query'     => 'Aws\Api\Serializer\QuerySerializer',
            'rest-json' => 'Aws\Api\Serializer\RestJsonSerializer',
            'rest-xml'  => 'Aws\Api\Serializer\RestXmlSerializer'
        ];

        $proto = $api->getProtocol();

        if (isset($mapping[$proto])) {
            return new $mapping[$proto]($api, $endpoint);
        }

        if ($proto == 'ec2') {
            return new QuerySerializer($api, $endpoint, new Ec2ParamBuilder());
        }

        throw new \UnexpectedValueException(
            'Unknown protocol: ' . $api->getProtocol()
        );
    }
public static function createSerializer ( Service $ api , $ endpoint ) { static $ mapping = [ 'json' => 'Aws\Api\Serializer\JsonRpcSerializer' , 'query' => 'Aws\Api\Serializer\QuerySerializer' , 'rest-json' => 'Aws\Api\Serializer\RestJsonSerializer' , 'rest-xml' => 'Aws\Api\Serializer\RestXmlSerializer' ] ; $ proto = $ api -> getProtocol ( ) ; if ( isset ( $ mapping [ $ proto ] ) ) { return new $ mapping [ $ proto ] ( $ api , $ endpoint ) ; } if ( $ proto == 'ec2' ) { return new QuerySerializer ( $ api , $ endpoint , new Ec2ParamBuilder ( ) ) ; } throw new \ UnexpectedValueException ( 'Unknown protocol: ' . $ api -> getProtocol ( ) ) ; }
Creates a request serializer for the provided API object.

@param Service $api      API that contains a protocol.
@param string  $endpoint Endpoint to send requests to.

@return callable
@throws \UnexpectedValueException
Creates a request serializer for the provided API object .