ArrayCarrier implements Carrier
FinalYes
Carrier backed by an associative array.
Provides case-insensitive key lookup for HTTP header compatibility. Keys are stored in their original case but lookups ignore case.
Example usage:
// Extract from incoming request headers
$carrier = new ArrayCarrier($request->getHeaders());
$spanContext = $propagator->extract($carrier);
// Inject into outgoing request
$carrier = new ArrayCarrier();
$propagator->inject($spanContext, $carrier);
$headers = $carrier->toArray();
Interfaces
- Carrier
- Carrier for propagating context across process boundaries.
Methods
- __construct() : mixed
- get() : null|string
- Get a value by key.
- set() : void
- Set a value.
- toArray() : array<string, string>
- Get the carrier data as an array.
Methods
__construct()
public
__construct([array<string, string> $data = [] ]) : mixed
Parameters
- $data : array<string, string> = []
-
The carrier data
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) : void
Parameters
- $key : string
-
The key to set
- $value : string
-
The value to set
toArray()
Get the carrier data as an array.
public
toArray() : array<string, string>