Flow PHP

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->unwrap();
Tags
implements

Interfaces

Carrier
Carrier for propagating context across process boundaries.

Methods

__construct()  : mixed
get()  : null|string
Get a value by key.
set()  : static
Set a value.
unwrap()  : array<string, string>
Unwrap and return the underlying data structure.

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) : 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() : array<string, string>
Return values
array<string, string>

        
On this page

Search results