BaggageInterface
extends
ImplicitContextKeyedInterface
in
Represents a value that can be stored within {@see ContextInterface}.
Tags
Table of Contents
Methods
- activate() : ScopeInterface
- Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.
- fromContext() : BaggageInterface
- Returns the {@see API\BaggageInterface} from the provided *$context*, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the provided context.
- getAll() : iterable<string|int, mixed>
- getBuilder() : BaggageBuilderInterface
- Returns a new empty {@see API\BaggageBuilderInterface}.
- getCurrent() : BaggageInterface
- Returns the current {@see Baggage} from the current {@see ContextInterface}, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the current context.
- getEmpty() : BaggageInterface
- Returns a new {@see API\BaggageInterface} with no entries.
- getEntry() : Entry|null
- getValue() : mixed
- Returns the value from the {@see API\Entry} with the provided *key*.
- isEmpty() : bool
- storeInContext() : ContextInterface
- Returns a new {@see ContextInterface} created by setting `$this` into the provided [@see ContextInterface}.
- toBuilder() : BaggageBuilderInterface
- Returns a new {@see API\BaggageBuilderInterface} pre-initialized with the contents of `$this`.
Methods
activate()
Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.
public
activate() : ScopeInterface
ScopeInterface::detach() MUST be called to properly restore the previous context.
This method is equivalent to Context::getCurrent().with($value).activate();
.
Tags
Return values
ScopeInterfacefromContext()
Returns the {@see API\BaggageInterface} from the provided *$context*, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the provided context.
public
static fromContext(ContextInterface $context) : BaggageInterface
Parameters
- $context : ContextInterface
Return values
BaggageInterfacegetAll()
public
getAll() : iterable<string|int, mixed>
Tags
Return values
iterable<string|int, mixed>getBuilder()
Returns a new empty {@see API\BaggageBuilderInterface}.
public
static getBuilder() : BaggageBuilderInterface
Return values
BaggageBuilderInterfacegetCurrent()
Returns the current {@see Baggage} from the current {@see ContextInterface}, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the current context.
public
static getCurrent() : BaggageInterface
Return values
BaggageInterfacegetEmpty()
Returns a new {@see API\BaggageInterface} with no entries.
public
static getEmpty() : BaggageInterface
Return values
BaggageInterfacegetEntry()
public
getEntry(string $key) : Entry|null
Parameters
- $key : string
Tags
Return values
Entry|nullgetValue()
Returns the value from the {@see API\Entry} with the provided *key*.
public
getValue(string $key) : mixed
Parameters
- $key : string
Tags
isEmpty()
public
isEmpty() : bool
Return values
boolstoreInContext()
Returns a new {@see ContextInterface} created by setting `$this` into the provided [@see ContextInterface}.
public
storeInContext(ContextInterface $context) : ContextInterface
Parameters
- $context : ContextInterface
Return values
ContextInterfacetoBuilder()
Returns a new {@see API\BaggageBuilderInterface} pre-initialized with the contents of `$this`.
public
toBuilder() : BaggageBuilderInterface