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

LogCollector::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
class LogCollector implements SummaryCollectorInterface
8
{
9
    use CollectorTrait;
10
11
    private array $messages = [];
12
13 2
    public function getCollected(): array
14
    {
15 2
        return $this->messages;
16
    }
17
18 2
    public function collect(string $level, $message, array $context, string $line): void
19
    {
20 2
        if (!$this->isActive()) {
21
            return;
22
        }
23
24 2
        $this->messages[] = [
25 2
            'time' => microtime(true),
26
            'level' => $level,
27
            'message' => $message,
28
            'context' => $context,
29
            'line' => $line,
30
        ];
31
    }
32
33 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...
34
    {
35 1
        $this->messages = [];
36
    }
37
38 1
    public function getSummary(): array
39
    {
40
        return [
41
            'logger' => [
42 1
                'total' => count($this->messages),
43
            ],
44
        ];
45
    }
46
}
47