Passed
Push — master ( 33d5ac...775805 )
by Dmitriy
03:03
created

WebViewCollector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A reset() 0 3 1
A getCollected() 0 3 1
A collect() 0 10 2
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