TimeoutComgateTransport
in package
implements
ITransport
FinalYes
Comgate client transport with HTTP timeouts.
The vendor transport sets no CURLOPT_TIMEOUT, so a stuck gateway would hold a PHP worker.
This one behaves the same (request and response formats match the library) with a 5 s connect
timeout and a 10 s total timeout.
Table of Contents
Interfaces
- ITransport
Constants
- CONNECT_TIMEOUT : mixed = 5
- TIMEOUT : mixed = 10
Properties
- $config : Config
- $connectTimeout : int
- $timeout : int
Methods
- __construct() : mixed
- delete() : Response
- get() : Response
- getConfig() : Config
- post() : Response
- postJson() : Response
- putJson() : Response
- setConfig() : ITransport
- createResponse() : MessageInterface
- execute() : Response
- rest() : Response
Constants
CONNECT_TIMEOUT
public
mixed
CONNECT_TIMEOUT
= 5
TIMEOUT
public
mixed
TIMEOUT
= 10
Properties
$config
private
Config
$config
$connectTimeout
private
int
$connectTimeout
= self::CONNECT_TIMEOUT
$timeout
private
int
$timeout
= self::TIMEOUT
Methods
__construct()
public
__construct(Config $config[, int $connectTimeout = self::CONNECT_TIMEOUT ][, int $timeout = self::TIMEOUT ]) : mixed
Parameters
- $config : Config
- $connectTimeout : int = self::CONNECT_TIMEOUT
- $timeout : int = self::TIMEOUT
delete()
public
delete(string $uri[, array<string|int, mixed> $options = [] ]) : Response
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
Return values
Responseget()
public
get(string $uri[, array<string|int, mixed> $options = [] ]) : Response
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
Return values
ResponsegetConfig()
public
getConfig() : Config
Return values
Configpost()
public
post(string $uri, array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : Response
Parameters
- $uri : string
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
ResponsepostJson()
public
postJson(string $uri, array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : Response
Parameters
- $uri : string
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
ResponseputJson()
public
putJson(string $uri, array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : Response
Parameters
- $uri : string
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
ResponsesetConfig()
public
setConfig(Config $config) : ITransport
Parameters
- $config : Config
Return values
ITransportcreateResponse()
private
createResponse(string $raw) : MessageInterface
Parameters
- $raw : string
Return values
MessageInterfaceexecute()
private
execute(non-empty-string $method, string $uri, string|null $body, array<string|int, string> $headers) : Response
Parameters
- $method : non-empty-string
- $uri : string
- $body : string|null
- $headers : array<string|int, string>
Return values
Responserest()
private
rest(non-empty-string $method, string $uri[, array<string|int, mixed> $data = [] ]) : Response
Parameters
- $method : non-empty-string
- $uri : string
- $data : array<string|int, mixed> = []