Passed
Pull Request — master (#118)
by Rustam
12:43
created

WebViewCollector::collect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
ccs 0
cts 7
cp 0
crap 6
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\View\Event\WebView\AfterRender;
9
10
final class WebViewCollector implements CollectorInterface, IndexCollectorInterface
11
{
12
    use CollectorTrait;
13
14
    private array $view = [];
15
16
    public function getCollected(): array
17
    {
18
        return $this->view;
19
    }
20
21
    public function collect(AfterRender $event): void
22
    {
23
        if (!$this->isActive()) {
24
            return;
25
        }
26
27
        $this->view[] = [
28
            'output' => $event->getResult(),
29
            'file' => $event->getFile(),
30
            'parameters' => $event->getParameters(),
31
        ];
32
    }
33
34
    #[ArrayShape(['totalAssetBundles' => 'int'])]
35
    public function getIndexData(): array
36
    {
37
        return [
38
        ];
39
    }
40
41
    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...
42
    {
43
        $this->view = [];
44
    }
45
}
46