summaryrefslogtreecommitdiff
path: root/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Reporter/CompositeReporter.php
blob: 78533cc7671ffdac17b2ebede8d89d23bef4c8bf (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
46
47
48
49
50
51
<?php

namespace Jaeger\Reporter;

use Jaeger\Span;

/**
 * CompositeReporter delegates reporting to one or more underlying reporters.
 */
class CompositeReporter implements ReporterInterface
{
    /**
     * @var ReporterInterface[]
     */
    private $reporters;

    /**
     * CompositeReporter constructor.
     *
     * @param ReporterInterface ...$reporters
     */
    public function __construct(ReporterInterface ...$reporters)
    {
        $this->reporters = $reporters;
    }

    /**
     * {@inheritdoc}
     *
     * @param Span $span
     * @return void
     */
    public function reportSpan(Span $span)
    {
        foreach ($this->reporters as $reporter) {
            $reporter->reportSpan($span);
        }
    }

    /**
     * {@inheritdoc}
     *
     * @return void
     */
    public function close()
    {
        foreach ($this->reporters as $reporter) {
            $reporter->close();
        }
    }
}