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

AssetCollector::getSummary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector\Web;
6
7
use Yiisoft\Assets\AssetBundle;
8
use Yiisoft\Yii\Debug\Collector\CollectorTrait;
9
use Yiisoft\Yii\Debug\Collector\SummaryCollectorInterface;
10
11
final class AssetCollector implements SummaryCollectorInterface
12
{
13
    use CollectorTrait;
14
15
    private array $assetBundles = [];
16
17
    public function getCollected(): array
18
    {
19
        return $this->assetBundles;
20
    }
21
22
    public function collect(AssetBundle $assetBundle): void
23
    {
24
        if (!$this->isActive()) {
25
            return;
26
        }
27
28
        $this->assetBundles[] = $assetBundle;
29
    }
30
31
    public function getSummary(): array
32
    {
33
        return [
34
            'asset' => [
35
                'bundles' => [
36
                    'total' => count($this->assetBundles),
37
                ],
38
            ],
39
        ];
40
    }
41
42
    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...
43
    {
44
        $this->assetBundles = [];
45
    }
46
}
47