diff options
author | Andrew Dolgov <[email protected]> | 2023-04-09 20:50:33 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-04-09 20:50:33 +0300 |
commit | 8f3646a9c93a06f76f6abb31020fdb74b4b1fc59 (patch) | |
tree | 4e6c9f39e0623ef70bedfee014f1bd20603f89ad /vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php | |
parent | a37eab2610a0a2bcb655258781c1c7e925dc94c0 (diff) |
exp: jaeger tracing
Diffstat (limited to 'vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php')
-rw-r--r-- | vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php b/vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php new file mode 100644 index 000000000..a814b45b5 --- /dev/null +++ b/vendor/opentracing/opentracing/src/OpenTracing/Mock/MockScope.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +namespace OpenTracing\Mock; + +use OpenTracing\Scope; +use OpenTracing\Span; + +final class MockScope implements Scope +{ + /** + * @var Span + */ + private $span; + + /** + * @var MockScopeManager + */ + private $scopeManager; + + /** + * @var bool + */ + private $finishSpanOnClose; + + /** + * @param MockScopeManager $scopeManager + * @param Span $span + * @param bool $finishSpanOnClose + */ + public function __construct( + MockScopeManager $scopeManager, + Span $span, + bool $finishSpanOnClose + ) { + $this->scopeManager = $scopeManager; + $this->span = $span; + $this->finishSpanOnClose = $finishSpanOnClose; + } + + /** + * {@inheritdoc} + */ + public function close(): void + { + if ($this->finishSpanOnClose) { + $this->span->finish(); + } + + $this->scopeManager->deactivate($this); + } + + /** + * {@inheritdoc} + * @return Span|MockSpan + */ + public function getSpan(): Span + { + return $this->span; + } +} |