Passed
Pull Request — master (#118)
by Rustam
16:25
created

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