Carrier
Carrier for propagating context across process boundaries.
A carrier is the transport mechanism for context propagation headers. Implementations handle specific transport types (HTTP headers, gRPC metadata, message queue headers, etc.).
Example usage:
// Inject context into a carrier
$carrier = new ResponseCarrier($response);
$propagator->inject($context, $carrier);
$modifiedResponse = $carrier->unwrap();
// With fluent chaining
$response = (new ResponseCarrier($response))
->set('X-Custom', 'value')
->unwrap();
Tags
Methods
- get() : null|string
- Get a value by key.
- set() : static
- Set a value.
- unwrap() : TWrapped
- Unwrap and return the underlying data structure.
Methods
get()
Get a value by key.
public
get(string $key) : null|string
Key lookup should be case-insensitive for HTTP header compatibility.
Parameters
- $key : string
-
The key to look up
Return values
null|string —The value, or null if not found
set()
Set a value.
public
set(string $key, string $value) : static
Parameters
- $key : string
-
The key to set
- $value : string
-
The value to set
Return values
static —For fluent chaining
unwrap()
Unwrap and return the underlying data structure.
public
unwrap() : TWrapped
Return values
TWrapped —The wrapped data structure