NullConnector
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
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Handle the final PSR request before it is sent.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new instance with the given arguments.
Determine if the response should throw a request exception.
Resolve the empty base URL.
Create a bounded request pool.
Resolve the HTTP connection used by this connector.
Resolve whether requests may replace this connector's base URL.
Get the default retry policy for requests without their own.
Copy the default body repository for a pending request.
Determine if the connector's rate limits apply to an operation.
Resolve the connector's admission policies.
Resolve the connector's rate limiter store.
Resolve the identity whose limits and cooldowns the connector uses.
Determine if a denied connector rate limit should be awaited.
Resolve the connector's stable cooldown key.
Resolve the connector cooldown imposed by a response.
Details
in
CreatesDtoFromResponse at line 17
mixed
createDtoFromResponse(Response $response)
Create a data object from the response.
in
Bootable at line 14
void
boot(PendingRequest $pendingRequest)
Configure a pending request for this resource.
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.
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.
in
HandlesPsrRequest at line 15
RequestInterface
handlePsrRequest(RequestInterface $request, PendingRequest $pendingRequest)
Handle the final PSR request before it is sent.
in
HasCustomResponses at line 23
string|null
resolveResponseClass(Response $response)
Resolve the custom response class.
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Makeable at line 12
static Makeable
make(mixed ...$arguments)
Create a new instance with the given arguments.
in
ManagesExceptions at line 15
bool|null
hasRequestFailed(Response $response)
Determine if the request failed.
in
ManagesExceptions at line 23
RequestException|null
getRequestException(Response $response)
Resolve the request exception.
in
ManagesExceptions at line 31
bool
shouldThrowRequestException(Response $response)
Determine if the response should throw a request exception.
at line 14
string
resolveBaseUrl()
Resolve the empty base URL.
in
Connector at line 54
Response
send(Request $request, MockClient|null $mockClient = null)
Send a request through this connector.
in
Connector at line 74
PendingRequest
createPendingRequest(Request $request)
Prepare a request for sending through this connector.
The pending request has run its hooks and request middleware but has not been finalized or sent.
in
Connector at line 85
void
clearCache(Request $counterpart)
Clear the cached response for a request without sending it.
in
Connector at line 100
Pool
pool(iterable|callable $requests = [], int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)
Create a bounded request pool.
in
Connector at line 112
string|null
resolveHttpConnection()
Resolve the HTTP connection used by this connector.
in
Connector at line 123
bool
allowsBaseUrlOverride()
Resolve whether requests may replace this connector's base URL.
in
Connector at line 133
final array
headers()
Get the default headers.
in
Connector at line 143
final array
queryParameters()
Get the default query parameters.
in
Connector at line 153
final array
options()
Get the default request options.
in
Connector at line 161
final Authenticator|null
authenticator()
Get the default authenticator.
in
Connector at line 169
final int|null
delayMilliseconds()
Get the default request delay in milliseconds.
in
Connector at line 177
final RetryPolicy|null
retryPolicy()
Get the default retry policy for requests without their own.
in
Connector at line 187
final BodyRepository|null
copyDefaultBodyRepository()
| internal |
Copy the default body repository for a pending request.
in
Connector at line 199
protected array
defaultHeaders()
Resolve the default headers.
in
Connector at line 209
protected array
defaultQuery()
Resolve the default query parameters.
in
Connector at line 219
protected array
defaultOptions()
Resolve the default request options.
in
Connector at line 227
protected Authenticator|null
defaultAuth()
Resolve the default authenticator.
in
Connector at line 235
protected int|null
defaultDelay()
Resolve the default request delay in milliseconds.
in
Connector at line 243
protected RetryPolicy|null
defaultRetryPolicy()
Resolve the default retry policy.
in
Connector at line 251
protected BodyRepository|null
defaultBodyRepository()
Resolve the default body repository.
in
Connector at line 261
final string|null
resolveCacheKey(PendingRequest $pendingRequest)
| internal |
Resolve the custom cache key.
in
Connector at line 272
final array
resolveCacheableMethods()
| internal |
Resolve the cacheable HTTP methods.
in
Connector at line 282
bool
usesRateLimits(PendingRequest $pendingRequest)
| internal |
Determine if the connector's rate limits apply to an operation.
in
Connector at line 293
array
resolveRateLimitPolicies(PendingRequest $pendingRequest)
| internal |
Resolve the connector's admission policies.
in
Connector at line 303
UnitEnum|string|null
resolveRateLimitStoreName()
| internal |
Resolve the connector's rate limiter store.
in
Connector at line 313
string
rateLimiterName()
| internal |
Resolve the identity whose limits and cooldowns the connector uses.
in
Connector at line 323
bool
shouldWaitForRateLimits(AdmissionPolicy|Cooldown $policy, Decision $result)
| internal |
Determine if a denied connector rate limit should be awaited.
in
Connector at line 333
string
resolveRateLimitCooldownKeyFor(PendingRequest $pendingRequest)
| internal |
Resolve the connector's stable cooldown key.
in
Connector at line 343
int|null
resolveRateLimitCooldownFor(Response $response)
| internal |
Resolve the connector cooldown imposed by a response.
in
Connector at line 351
protected string|null
cacheKey(PendingRequest $pendingRequest)
Define a custom cache key.
in
Connector at line 361
protected array
cacheableMethods()
Define the cacheable HTTP methods.
in
Connector at line 369
static void
flushState()
Flush all static state.