GroupedStateCollector::collect()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the reliforp/reli-prof package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Reli\Lib\Log\StateCollector;
15
16
final class GroupedStateCollector implements StateCollector
17
{
18
    /** @var StateCollector[] */
19
    private array $collectors;
20
21
    public function __construct(StateCollector ...$collectors)
22
    {
23
        $this->collectors = $collectors;
24
    }
25
26
    public function collect(): array
27
    {
28
        $result = [];
29
        foreach ($this->collectors as $collector) {
30
            $result += $collector->collect();
31
        }
32
        return $result;
33
    }
34
}
35