summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/api/Baggage/Baggage.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-10-01 16:00:34 +0300
committerAndrew Dolgov <fox@fakecake.org>2024-10-01 16:00:34 +0300
commit884fd92f1320d17daebb772297da03fb2cfa59b8 (patch)
tree3aa80af1df6ffa1d70f21f9fc4411f451c8b6c56 /vendor/open-telemetry/api/Baggage/Baggage.php
parent8fcc68baf5b0ff964a0a4a045353462586e0e316 (diff)
drop opentelemetry
Diffstat (limited to 'vendor/open-telemetry/api/Baggage/Baggage.php')
-rw-r--r--vendor/open-telemetry/api/Baggage/Baggage.php100
1 files changed, 0 insertions, 100 deletions
diff --git a/vendor/open-telemetry/api/Baggage/Baggage.php b/vendor/open-telemetry/api/Baggage/Baggage.php
deleted file mode 100644
index 06c701605..000000000
--- a/vendor/open-telemetry/api/Baggage/Baggage.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\API\Baggage;
-
-use OpenTelemetry\Context\Context;
-use OpenTelemetry\Context\ContextInterface;
-use OpenTelemetry\Context\ContextKeys;
-use OpenTelemetry\Context\ScopeInterface;
-
-final class Baggage implements BaggageInterface
-{
- private static ?self $emptyBaggage = null;
-
- /** @inheritDoc */
- public static function fromContext(ContextInterface $context): BaggageInterface
- {
- return $context->get(ContextKeys::baggage()) ?? self::getEmpty();
- }
-
- /** @inheritDoc */
- public static function getBuilder(): BaggageBuilderInterface
- {
- return new BaggageBuilder();
- }
-
- /** @inheritDoc */
- public static function getCurrent(): BaggageInterface
- {
- return self::fromContext(Context::getCurrent());
- }
-
- /** @inheritDoc */
- public static function getEmpty(): BaggageInterface
- {
- if (null === self::$emptyBaggage) {
- self::$emptyBaggage = new self();
- }
-
- return self::$emptyBaggage;
- }
-
- /** @var array<string, Entry> */
- private array $entries;
-
- /** @param array<string, Entry> $entries */
- public function __construct(array $entries = [])
- {
- $this->entries = $entries;
- }
-
- /** @inheritDoc */
- public function activate(): ScopeInterface
- {
- return Context::getCurrent()->withContextValue($this)->activate();
- }
-
- /** @inheritDoc */
- public function getEntry(string $key): ?Entry
- {
- return $this->entries[$key] ?? null;
- }
-
- /** @inheritDoc */
- public function getValue(string $key)
- {
- if (($entry = $this->getEntry($key)) !== null) {
- return $entry->getValue();
- }
-
- return null;
- }
-
- /** @inheritDoc */
- public function getAll(): iterable
- {
- foreach ($this->entries as $key => $entry) {
- yield $key => $entry;
- }
- }
-
- /** @inheritDoc */
- public function isEmpty(): bool
- {
- return $this->entries === [];
- }
-
- /** @inheritDoc */
- public function toBuilder(): BaggageBuilderInterface
- {
- return new BaggageBuilder($this->entries);
- }
-
- /** @inheritDoc */
- public function storeInContext(ContextInterface $context): ContextInterface
- {
- return $context->with(ContextKeys::baggage(), $this);
- }
-}