class NullConnector extends Connector

Traits

Properties

protected null|Response> $response

The default response class.

from  HasCustomResponses
static protected array $macros

The registered string macros.

from  Macroable

Methods

mixed
createDtoFromResponse(Response $response)

Create a data object from the response.

void
boot(PendingRequest $pendingRequest)

Configure a pending request for this resource.

from  Bootable
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

RequestInterface
handlePsrRequest(RequestInterface $request, PendingRequest $pendingRequest)

Handle the final PSR request before it is sent.

string|null
resolveResponseClass(Response $response)

Resolve the custom response class.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

static Makeable
make(mixed ...$arguments)

Create a new instance with the given arguments.

from  Makeable
bool|null
hasRequestFailed(Response $response)

Determine if the request failed.

getRequestException(Response $response)

Resolve the request exception.

bool
shouldThrowRequestException(Response $response)

Determine if the response should throw a request exception.

string
resolveBaseUrl()

Resolve the empty base URL.

send(Request $request, MockClient|null $mockClient = null)

Send a request through this connector.

pool(iterable|callable $requests = [], int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)

Create a bounded request pool.

string|null
resolveHttpConnection()

Resolve the HTTP connection used by this connector.

bool
allowsBaseUrlOverride()

Resolve whether requests may replace this connector's base URL.

array
headers()

Get the default headers.

array
queryParameters()

Get the default query parameters.

array
options()

Get the default request options.

authenticator()

Get the default authenticator.

int|null
delayMilliseconds()

Get the default request delay in milliseconds.

copyDefaultBodyRepository()

Copy the default body repository for a pending request.

array
defaultHeaders()

Resolve the default headers.

array
defaultQuery()

Resolve the default query parameters.

array
defaultOptions()

Resolve the default request options.

defaultAuth()

Resolve the default authenticator.

int|null
defaultDelay()

Resolve the default request delay in milliseconds.

defaultBodyRepository()

Resolve the default body repository.

string|null
resolveCacheKey(PendingRequest $pendingRequest)

Resolve the custom cache key.

array
resolveCacheableMethods()

Resolve the cacheable HTTP methods.

bool
usesRateLimits()

Determine if this connector defines rate limits.

array
resolveRateLimitPolicies(PendingRequest $pendingRequest)

Resolve the connector's admission policies.

UnitEnum|string|null
resolveRateLimitStoreName()

Resolve the connector's rate limiter store.

bool
shouldWaitForRateLimits()

Determine if connector rate limits should be awaited.

string
resolveRateLimitCooldownKeyFor(PendingRequest $pendingRequest)

Resolve the connector's stable cooldown key.

int|null
resolveRateLimitCooldownFor(Response $response)

Resolve the connector cooldown imposed by a response.

string|null
cacheKey(PendingRequest $pendingRequest)

Define a custom cache key.

array
cacheableMethods()

Define the cacheable HTTP methods.

static void
flushState()

Flush all static state.

Details

mixed createDtoFromResponse(Response $response)

Create a data object from the response.

Parameters

Response $response

Return Value

mixed

in Bootable at line 14
void boot(PendingRequest $pendingRequest)

Configure a pending request for this resource.

Parameters

PendingRequest $pendingRequest

Return Value

void

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in HandlesPsrRequest at line 15
RequestInterface handlePsrRequest(RequestInterface $request, PendingRequest $pendingRequest)

Handle the final PSR request before it is sent.

Parameters

RequestInterface $request
PendingRequest $pendingRequest

Return Value

RequestInterface

in HasCustomResponses at line 23
string|null resolveResponseClass(Response $response)

Resolve the custom response class.

Parameters

Response $response

Return Value

string|null

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Makeable at line 12
static Makeable make(mixed ...$arguments)

Create a new instance with the given arguments.

Parameters

mixed ...$arguments

Return Value

Makeable

in ManagesExceptions at line 15
bool|null hasRequestFailed(Response $response)

Determine if the request failed.

Parameters

Response $response

Return Value

bool|null

in ManagesExceptions at line 23
RequestException|null getRequestException(Response $response)

Resolve the request exception.

Parameters

Response $response

Return Value

RequestException|null

in ManagesExceptions at line 31
bool shouldThrowRequestException(Response $response)

Determine if the response should throw a request exception.

Parameters

Response $response

Return Value

bool

at line 14
string resolveBaseUrl()

Resolve the empty base URL.

Return Value

string

in Connector at line 51
Response send(Request $request, MockClient|null $mockClient = null)

Send a request through this connector.

Parameters

Request $request
MockClient|null $mockClient

Return Value

Response

in Connector at line 66
Pool pool(iterable|callable $requests = [], int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)

Create a bounded request pool.

Parameters

iterable|callable $requests
int $concurrency
callable|null $responseHandler
callable|null $exceptionHandler

Return Value

Pool

in Connector at line 78
string|null resolveHttpConnection()

Resolve the HTTP connection used by this connector.

Return Value

string|null

in Connector at line 86
bool allowsBaseUrlOverride()

Resolve whether requests may replace this connector's base URL.

Return Value

bool

in Connector at line 96
final array headers()

Get the default headers.

Return Value

array

in Connector at line 106
final array queryParameters()

Get the default query parameters.

Return Value

array

in Connector at line 116
final array options()

Get the default request options.

Return Value

array

in Connector at line 124
final Authenticator|null authenticator()

Get the default authenticator.

Return Value

Authenticator|null

in Connector at line 132
final int|null delayMilliseconds()

Get the default request delay in milliseconds.

Return Value

int|null

in Connector at line 142
final BodyRepository|null copyDefaultBodyRepository()

internal  
 

Copy the default body repository for a pending request.

Return Value

BodyRepository|null

in Connector at line 154
protected array defaultHeaders()

Resolve the default headers.

Return Value

array

in Connector at line 164
protected array defaultQuery()

Resolve the default query parameters.

Return Value

array

in Connector at line 174
protected array defaultOptions()

Resolve the default request options.

Return Value

array

in Connector at line 182
protected Authenticator|null defaultAuth()

Resolve the default authenticator.

Return Value

Authenticator|null

in Connector at line 190
protected int|null defaultDelay()

Resolve the default request delay in milliseconds.

Return Value

int|null

in Connector at line 198
protected BodyRepository|null defaultBodyRepository()

Resolve the default body repository.

Return Value

BodyRepository|null

in Connector at line 208
final string|null resolveCacheKey(PendingRequest $pendingRequest)

internal  
 

Resolve the custom cache key.

Parameters

PendingRequest $pendingRequest

Return Value

string|null

in Connector at line 219
final array resolveCacheableMethods()

internal  
 

Resolve the cacheable HTTP methods.

Return Value

array

in Connector at line 229
bool usesRateLimits()

internal  
 

Determine if this connector defines rate limits.

Return Value

bool

in Connector at line 240
array resolveRateLimitPolicies(PendingRequest $pendingRequest)

internal  
 

Resolve the connector's admission policies.

Parameters

PendingRequest $pendingRequest

Return Value

array

in Connector at line 250
UnitEnum|string|null resolveRateLimitStoreName()

internal  
 

Resolve the connector's rate limiter store.

Return Value

UnitEnum|string|null

in Connector at line 260
bool shouldWaitForRateLimits()

internal  
 

Determine if connector rate limits should be awaited.

Return Value

bool

in Connector at line 270
string resolveRateLimitCooldownKeyFor(PendingRequest $pendingRequest)

internal  
 

Resolve the connector's stable cooldown key.

Parameters

PendingRequest $pendingRequest

Return Value

string

in Connector at line 280
int|null resolveRateLimitCooldownFor(Response $response)

internal  
 

Resolve the connector cooldown imposed by a response.

Parameters

Response $response

Return Value

int|null

in Connector at line 288
protected string|null cacheKey(PendingRequest $pendingRequest)

Define a custom cache key.

Parameters

PendingRequest $pendingRequest

Return Value

string|null

in Connector at line 298
protected array cacheableMethods()

Define the cacheable HTTP methods.

Return Value

array

in Connector at line 306
static void flushState()

Flush all static state.

Return Value

void