function ArrayAccessGetterSetter::set
Overrides PropagationSetterInterface::set
File
-
vendor/
open-telemetry/ context/ Propagation/ ArrayAccessGetterSetter.php, line 82
Class
- ArrayAccessGetterSetter
- Default implementation of {This type is used if no custom getter/setter is provided to {
Namespace
OpenTelemetry\Context\PropagationCode
public function set(&$carrier, string $key, string $value) : void {
if ($key === '') {
throw new InvalidArgumentException('Unable to set value with an empty key');
}
if ($this->isSupportedCarrier($carrier)) {
if (($r = $this->resolveKey($carrier, $key)) !== $key) {
unset($carrier[$r]);
}
$carrier[$key] = $value;
return;
}
throw new InvalidArgumentException(sprintf('Unsupported carrier type: %s. Unable to set value associated with key:%s', get_debug_type($carrier), $key));
}