Baggage
in package
implements
BaggageInterface
Table of Contents
Interfaces
- BaggageInterface
- Represents a value that can be stored within {@see ContextInterface}.
Properties
- $emptyBaggage : self|null
- $entries : array<string|int, mixed>
Methods
- __construct() : mixed
- 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`.
Properties
$emptyBaggage
private
static self|null
$emptyBaggage
= null
$entries read-only
private
array<string|int, mixed>
$entries
= []
Methods
__construct()
public
__construct([array<string, Entry> $entries = [] ]) : mixed
Parameters
- $entries : array<string, Entry> = []
activate()
Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.
public
activate() : ScopeInterface
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
Tags
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
Tags
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
Tags
Return values
BaggageInterfacegetEmpty()
Returns a new {@see API\BaggageInterface} with no entries.
public
static getEmpty() : BaggageInterface
Tags
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
Tags
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
Tags
Return values
ContextInterfacetoBuilder()
Returns a new {@see API\BaggageBuilderInterface} pre-initialized with the contents of `$this`.
public
toBuilder() : BaggageBuilderInterface