Passed
Push — master ( f7ef7a...65c26d )
by Dmitriy
02:46
created

ServiceCollector::getIndexData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector;
6
7
final class ServiceCollector implements SummaryCollectorInterface
8
{
9
    use CollectorTrait;
10
11
    private array $items = [];
12
13 2
    public function getCollected(): array
14
    {
15 2
        return $this->items;
16
    }
17
18 7
    public function collect(
19
        string $service,
20
        string $class,
21
        string $method,
22
        ?array $arguments,
23
        $result,
24
        string $status,
25
        ?object $error,
26
        float $timeStart,
27
        float $timeEnd
28
    ): void {
29 7
        if (!$this->isActive()) {
30 5
            return;
31
        }
32
33 2
        $this->items[] = [
34
            'service' => $service,
35
            'class' => $class,
36
            'method' => $method,
37
            'arguments' => $arguments,
38
            'result' => $result,
39
            'status' => $status,
40
            'error' => $error,
41
            'timeStart' => $timeStart,
42
            'timeEnd' => $timeEnd,
43
        ];
44
    }
45
46 1
    public function getSummary(): array
47
    {
48
        return [
49
            'service' => [
50 1
                'total' => count($this->items),
51
            ],
52
        ];
53
    }
54
55 1
    private function reset(): void
0 ignored issues
show
Unused Code introduced by
The method reset() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
56
    {
57 1
        $this->items = [];
58
    }
59
}
60