summaryrefslogtreecommitdiff
path: root/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/ScopeManager.php
blob: eb5c276768b117ba0953d30a2e62567e56a0ab0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace Jaeger;

use OpenTracing\ScopeManager as OTScopeManager;
use OpenTracing\Span as OTSpan;
use OpenTracing\Scope as OTScope;

/**
 * {@inheritdoc}
 */
class ScopeManager implements OTScopeManager
{
    /**
     * @var OTScope
     */
    private $active;

    /**
     * {@inheritdoc}
     */
    public function activate(OTSpan $span, bool $finishSpanOnClose = self::DEFAULT_FINISH_SPAN_ON_CLOSE): OTScope
    {
        $this->active = new Scope($this, $span, $finishSpanOnClose);

        return $this->active;
    }

    /**
     * {@inheritdoc}
     */
    public function getActive(): ?OTScope
    {
        return $this->active;
    }

    /**
     * Sets the scope as active.
     * @param OTScope|null $scope
     */
    public function setActive(OTScope $scope = null)
    {
        $this->active = $scope;
    }
}