class Scope implements ContextStorageScopeInterface

internal  
 

Represent one context attachment owned by a single execution unit.

Properties

protected array<array-key, mixed> $localStorage
protected Scope|null $previous
protected Scope|null $next
protected bool $detached

Methods

__construct(CoroutineContextStorage $storage, ContextState $state, ContextInterface $context)

Create a context scope.

bool
offsetExists(mixed $offset)

Determine whether local scope storage contains an offset.

mixed
offsetGet(mixed $offset)

Return a value from local scope storage.

void
offsetSet(mixed $offset, mixed $value)

Store a value in local scope storage.

void
offsetUnset(mixed $offset)

Remove a value from local scope storage.

ContextInterface
context()

Return the context attached by this scope.

int
detach()

Detach this scope from its owning execution unit.

void
linkAfter(Scope|null $previous)

Link this scope after the previous active scope.

Scope|null
unlink()

Unlink this scope and return its previous scope.

Scope|null
previous()

Return the previous scope in the stack.

bool
isDetached()

Determine whether this scope was already detached.

void
markDetached()

Mark this scope as detached.

Details

at line 31
__construct(CoroutineContextStorage $storage, ContextState $state, ContextInterface $context)

Create a context scope.

Parameters

CoroutineContextStorage $storage
ContextState $state
ContextInterface $context

at line 41
bool offsetExists(mixed $offset)

Determine whether local scope storage contains an offset.

Parameters

mixed $offset

Return Value

bool

at line 50
mixed offsetGet(mixed $offset)

Return a value from local scope storage.

Parameters

mixed $offset

Return Value

mixed

at line 59
void offsetSet(mixed $offset, mixed $value)

Store a value in local scope storage.

Parameters

mixed $offset
mixed $value

Return Value

void

at line 68
void offsetUnset(mixed $offset)

Remove a value from local scope storage.

Parameters

mixed $offset

Return Value

void

at line 77
ContextInterface context()

Return the context attached by this scope.

Return Value

ContextInterface

at line 86
int detach()

Detach this scope from its owning execution unit.

Return Value

int

at line 99
void linkAfter(Scope|null $previous)

Link this scope after the previous active scope.

Parameters

Scope|null $previous

Return Value

void

Unlink this scope and return its previous scope.

Return Value

Scope|null

at line 132
Scope|null previous()

Return the previous scope in the stack.

Return Value

Scope|null

at line 140
bool isDetached()

Determine whether this scope was already detached.

Return Value

bool

at line 148
void markDetached()

Mark this scope as detached.

Return Value

void