BaseHttpClient

class Firstred\PostNL\HttpClient\BaseHttpClient

Summary

Methods

Constants

DEFAULT_TIMEOUT = 80
DEFAULT_CONNECT_TIMEOUT = 30

Properties

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$timeout
Type:

int

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$connectTimeout
Type:

int

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$verify
Verify the server SSL certificate.
Type:

bool | string

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$pendingRequests
Type:

array

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$logger
Type:

\Psr\Log\LoggerInterface

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$maxRetries
Type:

int

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$concurrency
Type:

int

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$requestFactory
Type:

\Psr\Http\Message\RequestFactoryInterface | \Firstred\PostNL\Factory\RequestFactoryInterface

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$responseFactory
Type:

\Psr\Http\Message\ResponseFactoryInterface | \Firstred\PostNL\Factory\ResponseFactoryInterface

protected static property Firstred\PostNL\HttpClient\BaseHttpClient::$streamFactory
Type:

\Psr\Http\Message\StreamFactoryInterface | \Firstred\PostNL\Factory\StreamFactoryInterface

Methods

public Firstred\PostNL\HttpClient\BaseHttpClient::getTimeout()
Get timeout.
Returns:

int

public Firstred\PostNL\HttpClient\BaseHttpClient::setTimeout($seconds)
Set timeout.
Parameters:
  • $seconds (int)

Returns:

static

public Firstred\PostNL\HttpClient\BaseHttpClient::getConnectTimeout()
Get connection timeout.
Returns:

int

public Firstred\PostNL\HttpClient\BaseHttpClient::setConnectTimeout($seconds)
Set connection timeout.
Parameters:
  • $seconds (int)

Returns:

static

public Firstred\PostNL\HttpClient\BaseHttpClient::getVerify()
Return verify setting.
Returns:

bool | string

Deprecated:

public Firstred\PostNL\HttpClient\BaseHttpClient::setVerify($verify)
Set the verify setting.
Parameters:
  • $verify (bool | string)

Returns:

static

Deprecated:

public Firstred\PostNL\HttpClient\BaseHttpClient::getLogger()
Get logger.
Returns:

\Psr\Log\LoggerInterface

public Firstred\PostNL\HttpClient\BaseHttpClient::setLogger($logger)
Set the logger.
Parameters:
  • $logger (Psr\Log\LoggerInterface)

Returns:

static

public Firstred\PostNL\HttpClient\BaseHttpClient::getMaxRetries()
Return max retries.
Returns:

int

public Firstred\PostNL\HttpClient\BaseHttpClient::setMaxRetries($maxRetries)
Set the amount of retries.
Parameters:
  • $maxRetries (int)

Returns:

static

public Firstred\PostNL\HttpClient\BaseHttpClient::setConcurrency($concurrency)
Set the concurrency.
Parameters:
  • $concurrency (int)

Returns:

static

public Firstred\PostNL\HttpClient\BaseHttpClient::getConcurrency()
Return concurrency.
Returns:

int

public Firstred\PostNL\HttpClient\BaseHttpClient::addOrUpdateRequest($id, $request)
Adds a request to the list of pending requests
Using the ID you can replace a request.
Parameters:
  • $id (string) Request ID

  • $request (Psr\Http\Message\RequestInterface) PSR-7 request

Returns:

int | string

Throws:

\Firstred\PostNL\Exception\InvalidArgumentException

public Firstred\PostNL\HttpClient\BaseHttpClient::removeRequest($id)
Remove a request from the list of pending requests.
Parameters:
  • $id (string)

public Firstred\PostNL\HttpClient\BaseHttpClient::clearRequests()
Clear all pending requests.
public Firstred\PostNL\HttpClient\BaseHttpClient::doRequests( $requests=\[\])
Do all async requests.
Exceptions are captured into the result array
Parameters:
  • $requests (Psr\Http\Message\RequestInterface[])

Returns:

\Firstred\PostNL\Exception\HttpClientException[] | \Psr\Http\Message\ResponseInterface[]

Throws:

\Firstred\PostNL\Exception\InvalidArgumentException

public Firstred\PostNL\HttpClient\BaseHttpClient::getRequestFactory()
Get PSR-7 Request factory.
Returns:

\Psr\Http\Message\RequestFactoryInterface | \Firstred\PostNL\Factory\RequestFactoryInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Since:

1.3.0

public Firstred\PostNL\HttpClient\BaseHttpClient::setRequestFactory($requestFactory)
Set PSR-7 Request factory.
Parameters:
Returns:

static

Since:

1.3.0

public Firstred\PostNL\HttpClient\BaseHttpClient::getResponseFactory()
Get PSR-7 Response factory.
Returns:

\Psr\Http\Message\ResponseFactoryInterface | \Firstred\PostNL\Factory\ResponseFactoryInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Since:

1.3.0

public Firstred\PostNL\HttpClient\BaseHttpClient::setResponseFactory($responseFactory)
Set PSR-7 Response factory.
Parameters:
Returns:

static

Since:

1.3.0

public Firstred\PostNL\HttpClient\BaseHttpClient::getStreamFactory()
Set PSR-7 Stream factory.
Returns:

\Psr\Http\Message\StreamFactoryInterface | \Firstred\PostNL\Factory\StreamFactoryInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Since:

1.3.0

public Firstred\PostNL\HttpClient\BaseHttpClient::setStreamFactory($streamFactory)
Set PSR-7 Stream factory.
Parameters:
Returns:

static

Since:

1.3.0