Test Failed
Pull Request — master (#93)
by Dmitriy
02:52
created

VarDumperCollector::getSummary()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\VarDumper\Debug;
6
7
use Yiisoft\Yii\Debug\Collector\CollectorTrait;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\Debug\Collector\CollectorTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Yiisoft\Yii\Debug\Collector\SummaryCollectorInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\Debug\Collec...mmaryCollectorInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
final class VarDumperCollector implements SummaryCollectorInterface
11
{
12
    use CollectorTrait;
13
14
    private array $vars = [];
15
16
    public function collectVar(mixed $variable, string $line): void
17
    {
18
        $this->vars[] = [
19
            'variable' => $variable,
20
            'line' => $line,
21
        ];
22
    }
23
24
    public function getCollected(): array
25
    {
26
        if (!$this->isActive()) {
27
            return [];
28
        }
29
30
        return [
31
            'var-dumper' => $this->vars,
32
        ];
33
    }
34
35
    public function getSummary(): array
36
    {
37
        if (!$this->isActive()) {
38
            return [];
39
        }
40
41
        return [
42
            'var-dumper' => [
43
                'total' => count($this->vars),
44
            ],
45
        ];
46
    }
47
}
48