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

Breadcrumb

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

class MultiTextMapPropagator

Hierarchy

  • class \OpenTelemetry\Context\Propagation\MultiTextMapPropagator implements \OpenTelemetry\Context\Propagation\TextMapPropagatorInterface

Expanded class hierarchy of MultiTextMapPropagator

1 file declares its use of MultiTextMapPropagator
PropagatorFactory.php in vendor/open-telemetry/sdk/Propagation/PropagatorFactory.php

File

vendor/open-telemetry/context/Propagation/MultiTextMapPropagator.php, line 14

Namespace

OpenTelemetry\Context\Propagation
View source
final class MultiTextMapPropagator implements TextMapPropagatorInterface {
    
    /** @var list<string> */
    private readonly array $fields;
    
    /**
     * @no-named-arguments
     *
     * @param list<TextMapPropagatorInterface> $propagators
     */
    public function __construct(array $propagators) {
        $this->fields = $this->extractFields($this->propagators);
    }
    public function fields() : array {
        return $this->fields;
    }
    public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null) : void {
        foreach ($this->propagators as $propagator) {
            $propagator->inject($carrier, $setter, $context);
        }
    }
    public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null) : ContextInterface {
        $context ??= Context::getCurrent();
        foreach ($this->propagators as $propagator) {
            $context = $propagator->extract($carrier, $getter, $context);
        }
        return $context;
    }
    
    /**
     * @param list<TextMapPropagatorInterface> $propagators
     * @return list<string>
     */
    private function extractFields(array $propagators) : array {
        return array_values(array_unique(array_merge(...array_map(static fn(TextMapPropagatorInterface $propagator) => $propagator->fields(), $propagators))));
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
MultiTextMapPropagator::$fields private property @var list&lt;string&gt;
MultiTextMapPropagator::extract public function Extracts specific values from the provided carrier into the provided {via an { Overrides TextMapPropagatorInterface::extract
MultiTextMapPropagator::extractFields private function
MultiTextMapPropagator::fields public function Returns list of fields that will be used by this propagator. Overrides TextMapPropagatorInterface::fields
MultiTextMapPropagator::inject public function Injects specific values from the provided {via an { Overrides TextMapPropagatorInterface::inject
MultiTextMapPropagator::__construct public function @no-named-arguments

API Navigation

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