From 884fd92f1320d17daebb772297da03fb2cfa59b8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 1 Oct 2024 16:00:34 +0300 Subject: drop opentelemetry --- .../Propagation/ArrayAccessGetterSetter.php | 129 --------------------- .../context/Propagation/MultiTextMapPropagator.php | 83 ------------- .../context/Propagation/NoopTextMapPropagator.php | 36 ------ .../Propagation/PropagationGetterInterface.php | 25 ---- .../Propagation/PropagationSetterInterface.php | 16 --- .../SanitizeCombinedHeadersPropagationGetter.php | 46 -------- .../Propagation/TextMapPropagatorInterface.php | 40 ------- 7 files changed, 375 deletions(-) delete mode 100644 vendor/open-telemetry/context/Propagation/ArrayAccessGetterSetter.php delete mode 100644 vendor/open-telemetry/context/Propagation/MultiTextMapPropagator.php delete mode 100644 vendor/open-telemetry/context/Propagation/NoopTextMapPropagator.php delete mode 100644 vendor/open-telemetry/context/Propagation/PropagationGetterInterface.php delete mode 100644 vendor/open-telemetry/context/Propagation/PropagationSetterInterface.php delete mode 100644 vendor/open-telemetry/context/Propagation/SanitizeCombinedHeadersPropagationGetter.php delete mode 100644 vendor/open-telemetry/context/Propagation/TextMapPropagatorInterface.php (limited to 'vendor/open-telemetry/context/Propagation') diff --git a/vendor/open-telemetry/context/Propagation/ArrayAccessGetterSetter.php b/vendor/open-telemetry/context/Propagation/ArrayAccessGetterSetter.php deleted file mode 100644 index 51263044d..000000000 --- a/vendor/open-telemetry/context/Propagation/ArrayAccessGetterSetter.php +++ /dev/null @@ -1,129 +0,0 @@ -isSupportedCarrier($carrier)) { - $keys = []; - foreach ($carrier as $key => $_) { - $keys[] = (string) $key; - } - - return $keys; - } - - throw new InvalidArgumentException( - sprintf( - 'Unsupported carrier type: %s.', - is_object($carrier) ? get_class($carrier) : gettype($carrier), - ) - ); - } - - /** {@inheritdoc} */ - 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', - is_object($carrier) ? get_class($carrier) : gettype($carrier), - $key - ) - ); - } - - /** {@inheritdoc} */ - 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', - is_object($carrier) ? get_class($carrier) : gettype($carrier), - $key - ) - ); - } - - private function isSupportedCarrier($carrier): bool - { - return is_array($carrier) || $carrier instanceof ArrayAccess && $carrier instanceof Traversable; - } - - private function resolveKey($carrier, string $key): string - { - if (isset($carrier[$key])) { - return $key; - } - - foreach ($carrier as $k => $_) { - $k = (string) $k; - if (strcasecmp($k, $key) === 0) { - return $k; - } - } - - return $key; - } -} diff --git a/vendor/open-telemetry/context/Propagation/MultiTextMapPropagator.php b/vendor/open-telemetry/context/Propagation/MultiTextMapPropagator.php deleted file mode 100644 index 075fe98fe..000000000 --- a/vendor/open-telemetry/context/Propagation/MultiTextMapPropagator.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ - private array $propagators = []; - - /** - * @readonly - * - * @var list - */ - private array $fields; - - /** - * @no-named-arguments - * - * @param list $propagators - */ - public function __construct(array $propagators) - { - $this->propagators = $propagators; - $this->fields = $this->extractFields($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 $propagators - * @return list - */ - private function extractFields(array $propagators): array - { - return array_values( - array_unique( - // Phan seems to struggle here with the variadic argument - // @phan-suppress-next-line PhanParamTooFewInternalUnpack - array_merge( - ...array_map( - static fn (TextMapPropagatorInterface $propagator) => $propagator->fields(), - $propagators - ) - ) - ) - ); - } -} diff --git a/vendor/open-telemetry/context/Propagation/NoopTextMapPropagator.php b/vendor/open-telemetry/context/Propagation/NoopTextMapPropagator.php deleted file mode 100644 index c408cfc79..000000000 --- a/vendor/open-telemetry/context/Propagation/NoopTextMapPropagator.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ - public function keys($carrier): array; - - /** - * Gets the value of a given key from a carrier. - */ - public function get($carrier, string $key) : ?string; -} diff --git a/vendor/open-telemetry/context/Propagation/PropagationSetterInterface.php b/vendor/open-telemetry/context/Propagation/PropagationSetterInterface.php deleted file mode 100644 index 75e205628..000000000 --- a/vendor/open-telemetry/context/Propagation/PropagationSetterInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -getter = $getter; - } - - public function keys($carrier): array - { - return $this->getter->keys($carrier); - } - - public function get($carrier, string $key): ?string - { - $value = $this->getter->get($carrier, $key); - if ($value === null) { - return null; - } - - return preg_replace( - [self::SERVER_CONCAT_HEADERS_REGEX, self::TRAILING_LEADING_SEPARATOR_REGEX], - [self::LIST_MEMBERS_SEPARATOR], - $value, - ); - } -} diff --git a/vendor/open-telemetry/context/Propagation/TextMapPropagatorInterface.php b/vendor/open-telemetry/context/Propagation/TextMapPropagatorInterface.php deleted file mode 100644 index fdf2d5141..000000000 --- a/vendor/open-telemetry/context/Propagation/TextMapPropagatorInterface.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ - public function fields() : array; - - /** - * Injects specific values from the provided {@see ContextInterface} into the provided carrier - * via an {@see PropagationSetterInterface}. - * - * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/context/api-propagators.md#textmap-inject - * - * @param mixed $carrier - */ - public function inject(&$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void; - - /** - * Extracts specific values from the provided carrier into the provided {@see ContextInterface} - * via an {@see PropagationGetterInterface}. - * - * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/context/api-propagators.md#textmap-extract - */ - public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface; -} -- cgit v1.2.3-54-g00ecf