Skip to content

Commit a1f2200

Browse files
committed
Added remove() method
1 parent cede402 commit a1f2200

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/Tracer/InjectableInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
interface InjectableInterface
99
{
1010
public function assign(SpanContext $context): InjectableInterface;
11+
12+
public function remove(SpanContext $context) : InjectableInterface;
1113
}

src/Tracer/Tracer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ public function assign(SpanContext $context): InjectableInterface
5858
return $this;
5959
}
6060

61+
public function remove(SpanContext $context): InjectableInterface
62+
{
63+
if (0 === $this->stack->count()) {
64+
return $this;
65+
}
66+
67+
if (spl_object_hash($this->stack->top()) !== spl_object_hash($context)) {
68+
throw new \LogicException('Current context is different');
69+
}
70+
$this->stack->pop();
71+
72+
return $this;
73+
}
74+
75+
6176
public function getClient(): ClientInterface
6277
{
6378
return $this->client;

0 commit comments

Comments
 (0)