AssetCollector::reset()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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