GroupedStateCollector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A collect() 0 7 2
A __construct() 0 3 1
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