Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ArrayAccessGetterSetter.php

function ArrayAccessGetterSetter::get

Overrides PropagationGetterInterface::get

File

vendor/open-telemetry/context/Propagation/ArrayAccessGetterSetter.php, line 59

Class

ArrayAccessGetterSetter
Default implementation of {This type is used if no custom getter/setter is provided to {

Namespace

OpenTelemetry\Context\Propagation

Code

public function get($carrier, string $key) : ?string {
    if ($this->isSupportedCarrier($carrier)) {
        $value = $carrier[$this->resolveKey($carrier, $key)] ?? null;
        if (is_array($value) && $value) {
            $value = $value[array_key_first($value)];
        }
        return is_string($value) ? $value : null;
    }
    throw new InvalidArgumentException(sprintf('Unsupported carrier type: %s. Unable to get value associated with key:%s', get_debug_type($carrier), $key));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal