class RequestContext

Constants

protected VALUES_CONTEXT_KEY

Methods

static Request
get(int|null $coroutineId = null)

Get the current request from context.

static Request
set(Request $request, int|null $coroutineId = null)

Set the current request in context.

static bool
has(int|null $coroutineId = null)

Determine if a request exists in context.

static void
forget(int|null $coroutineId = null)

Remove the request from context.

static Request|null
getOrNull(int|null $coroutineId = null)

Get the current request from context, or null if not set.

static mixed
getValue(UnitEnum|string $key, mixed $default = null, int|null $coroutineId = null)

Retrieve a value scoped to the current request.

static mixed
setValue(UnitEnum|string $key, mixed $value, int|null $coroutineId = null)

Store a value until the request is replaced or forgotten.

static void
forgetValue(UnitEnum|string $key, int|null $coroutineId = null)

Remove a value scoped to the current request.

static mixed
getOrSetValue(UnitEnum|string $key, mixed $value, int|null $coroutineId = null)

Retrieve a request-scoped value, storing the supplied value when missing.

Details

at line 19
static Request get(int|null $coroutineId = null)

Get the current request from context.

Parameters

int|null $coroutineId

Return Value

Request

at line 29
static Request set(Request $request, int|null $coroutineId = null)

Set the current request in context.

Replacing the request clears the coroutine's internal request-scoped caches.

Parameters

Request $request
int|null $coroutineId

Return Value

Request

at line 41
static bool has(int|null $coroutineId = null)

Determine if a request exists in context.

Parameters

int|null $coroutineId

Return Value

bool

at line 51
static void forget(int|null $coroutineId = null)

Remove the request from context.

Also clear the coroutine's internal request-scoped caches.

Parameters

int|null $coroutineId

Return Value

void

at line 60
static Request|null getOrNull(int|null $coroutineId = null)

Get the current request from context, or null if not set.

Parameters

int|null $coroutineId

Return Value

Request|null

at line 70
static mixed getValue(UnitEnum|string $key, mixed $default = null, int|null $coroutineId = null)

internal  framework cache storage; use request attributes for application request metadata
 

Retrieve a value scoped to the current request.

Parameters

UnitEnum|string $key
mixed $default
int|null $coroutineId

Return Value

mixed

at line 82
static mixed setValue(UnitEnum|string $key, mixed $value, int|null $coroutineId = null)

internal  framework cache storage; use request attributes for application request metadata
 

Store a value until the request is replaced or forgotten.

Parameters

UnitEnum|string $key
mixed $value
int|null $coroutineId

Return Value

mixed

at line 97
static void forgetValue(UnitEnum|string $key, int|null $coroutineId = null)

internal  framework cache storage; use request attributes for application request metadata
 

Remove a value scoped to the current request.

Parameters

UnitEnum|string $key
int|null $coroutineId

Return Value

void

at line 112
static mixed getOrSetValue(UnitEnum|string $key, mixed $value, int|null $coroutineId = null)

internal  framework cache storage; use request attributes for application request metadata
 

Retrieve a request-scoped value, storing the supplied value when missing.

Parameters

UnitEnum|string $key
mixed $value
int|null $coroutineId

Return Value

mixed