PortaBilling API

Psr18Adapter
in package
implements ClientAdapterInterface

Generic adaptor allows to use any PSR-18 compatible HTTP client

Interfaces, Classes, Traits and Enums

ClientAdapterInterface
Interface for HTTP client adapters

Table of Contents

__construct()  : mixed
Setup adaptor with externally suppied PSR-18 client
concurrent()  : array<string|int, mixed>
Just sends the requests one by one, slow and sad
send()  : ResponseInterface
Sending request usong PSR-18 compatible client
sendAsync()  : mixed
Stub to throw PortaException in a case of it's called when not supported

Methods

__construct()

Setup adaptor with externally suppied PSR-18 client

public __construct(ClientInterface $client) : mixed
Parameters
$client : ClientInterface
Return values
mixed

concurrent()

Just sends the requests one by one, slow and sad

public concurrent(iteratable<string|int, mixed> $requests[, int $concurency = 20 ]) : array<string|int, mixed>

PSR-18 only support single call, so for PSR-18 adapter we have to simulete concurent calls by sending requests one by one

Parameters
$requests : iteratable<string|int, mixed>
$concurency : int = 20
Return values
array<string|int, mixed>

send()

Sending request usong PSR-18 compatible client

public send(RequestInterface $request) : ResponseInterface
Parameters
$request : RequestInterface
Tags
throws
PortaConnectException
throws
PortaException
Return values
ResponseInterface

sendAsync()

Stub to throw PortaException in a case of it's called when not supported

public sendAsync(RequestInterface $request) : mixed
Parameters
$request : RequestInterface
Tags
throws
PortaException
Return values
mixed

Client-dependent promise object.

It must fulfill with ResponseInterface or reject with PortaException or it's child.

Search results