SymfonyHttpClient

class Firstred\PostNL\HttpClient\SymfonyHttpClient
Class SymfonyHttpClient.
Parent:

Firstred\PostNL\HttpClient\BaseHttpClient

Implements:

Firstred\PostNL\HttpClient\HttpClientInterface

Summary

Methods

Constants

DEFAULT_TIMEOUT = 60
DEFAULT_CONNECT_TIMEOUT = 20

Properties

protected static property Firstred\PostNL\HttpClient\SymfonyHttpClient::$defaultOptions
Type:

array

private static property Firstred\PostNL\HttpClient\SymfonyHttpClient::$client
Type:

\Symfony\Contracts\HttpClient\HttpClientInterface | null

Methods

public Firstred\PostNL\HttpClient\SymfonyHttpClient::__construct(\\Symfony\\Contracts\\HttpClient\\HttpClientInterface|null $client=null, \\Psr\\Log\\LoggerInterface|null $logger=null, $concurrency=5, $maxRetries=5)
SymfonyHttpClient constructor.
Parameters:
  • $client (Symfony\Contracts\HttpClient\HttpClientInterface | null)

  • $logger (Psr\Log\LoggerInterface | null)

  • $concurrency (int)

  • $maxRetries (int)

Since:

1.3.0 Custom constructor

private Firstred\PostNL\HttpClient\SymfonyHttpClient::getClient()
Get the Symfony HTTP Client.
Returns:

\Symfony\Contracts\HttpClient\HttpClientInterface | null

Throws:

\Firstred\PostNL\Exception\HttpClientException

public Firstred\PostNL\HttpClient\SymfonyHttpClient::setOption($name, $value)
Set Symfony HTTP Client option.
Parameters:
  • $name (string)

  • $value (mixed)

Returns:

static

public Firstred\PostNL\HttpClient\SymfonyHttpClient::getOption($name)
Get Symfony HTTP Client option.
Parameters:
  • $name (string)

Returns:

mixed | null

public Firstred\PostNL\HttpClient\SymfonyHttpClient::doRequest($request)
Do a single request.
Exceptions are captured into the result array
Parameters:
  • $request (Psr\Http\Message\RequestInterface)

Returns:

\Psr\Http\Message\ResponseInterface

Throws:

\Firstred\PostNL\Exception\HttpClientException

public Firstred\PostNL\HttpClient\SymfonyHttpClient::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[]

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

Returns:

static

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

Returns:

static

private Firstred\PostNL\HttpClient\SymfonyHttpClient::convertPsrRequestToSymfonyHttpClientRequestParams($psrRequest)
Parameters:
  • $psrRequest (Psr\Http\Message\RequestInterface)

Returns:

array

Since:

1.3.0

private Firstred\PostNL\HttpClient\SymfonyHttpClient::convertSymfonyHttpClientResponseToPsrResponse($symfonyHttpClientResponse)
Parameters:
  • $symfonyHttpClientResponse (Symfony\Contracts\HttpClient\ResponseInterface)

Returns:

\Psr\Http\Message\ResponseInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Throws:

\Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Throws:

\Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Throws:

\Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Throws:

\Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface

Throws:

\Firstred\PostNL\Exception\NotSupportedException

Throws:

\Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface

Throws:

\Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface

Since:

1.3.0