TransportInterface
interface TransportInterface (View source)
Contract for the low-level HTTP transport used by {AbstractClient}.
Isolating the cURL layer behind this seam lets the request() lifecycle run against a test double (e.g. a record/replay cassette transport) so the whole path is exercisable offline, without touching the live API. The production implementation is {\CNIC\HttpTransport}.
Methods
Execute a POST request and return the raw response.
Close and release any underlying connection/handle.
Details
array
post(string $url, string $data, int $timeoutSeconds, string $userAgent, array $options = [])
Execute a POST request and return the raw response.
$options carries the caller's transport tuning (see {\CNIC\AbstractClient::setExtraCurlOptions()}). The contract is that a caller's option wins over the implementation's own default for the same key — an implementation that must own a key is required to reject it by throwing {\CNIC\Exception\UnsupportedFeatureException}, naming what it refused, rather than quietly ignoring it. Which keys those are is implementation-specific: for the production transport they are {\CNIC\HttpTransport::PROTECTED_OPTIONS}, while a test double typically owns none and simply records what it was given.
void
close()
Close and release any underlying connection/handle.