Passed
Pull Request — master (#160)
by Dmitriy
04:52 queued 02:01
created

WebViewCollector::collect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector\Web;
6
7
use Yiisoft\View\Event\WebView\AfterRender;
8
use Yiisoft\Yii\Debug\Collector\CollectorInterface;
9
use Yiisoft\Yii\Debug\Collector\CollectorTrait;
10
11
final class WebViewCollector implements CollectorInterface
12
{
13
    use CollectorTrait;
14
15
    private array $renders = [];
16
17
    public function getCollected(): array
18
    {
19
        return $this->renders;
20
    }
21
22
    public function collect(AfterRender $event): void
23
    {
24
        if (!$this->isActive()) {
25
            return;
26
        }
27
28
        $this->renders[] = [
29
            'output' => $event->getResult(),
30
            'file' => $event->getFile(),
31
            'parameters' => $event->getParameters(),
32
        ];
33
    }
34
35
    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...
36
    {
37
        $this->renders = [];
38
    }
39
}
40