ResponseTransformerInterface
in
Interface ResponseTransformerInterface
Tags
Table of Contents
Methods
- createCustomResponse() : array<int|string, mixed>
- Transforms PSR-7 response into response array.
- createResponse() : ResponseInterface
- Transforms PSR-7 response into response model.
- getHandler() : HandlerInterface|null
- Returns HandlerInterface.
Methods
createCustomResponse()
Transforms PSR-7 response into response array.
public
createCustomResponse(string $baseUrl, RequestInterface $request, ResponseInterface $response) : array<int|string, mixed>
This method should do the following operations:
- It should convert PSR-7 response object into the response model of provided type.
- It should automatically detect an API error and throw an
ApiExceptionInterface
instance. - It can throw a
HandlerException
instance if necessary.
This method should be used only for custom requests.
Parameters
- $baseUrl : string
- $request : RequestInterface
- $response : ResponseInterface
Tags
Return values
array<int|string, mixed>createResponse()
Transforms PSR-7 response into response model.
public
createResponse(string $baseUrl, RequestInterface $request, ResponseInterface $response, string $type) : ResponseInterface
This method should do the following operations:
- It should convert PSR-7 response object into the response model of provided type.
- It should automatically detect an API error and throw an
ApiExceptionInterface
instance. - It can throw a
HandlerException
instance if necessary.
Parameters
- $baseUrl : string
- $request : RequestInterface
- $response : ResponseInterface
- $type : string
Tags
Return values
ResponseInterfacegetHandler()
Returns HandlerInterface.
public
getHandler() : HandlerInterface|null
This method can return null
. ClientBuilder
won't inject additional handlers into the handlers chain if this
method returns null
. No error or exception will be raised.