Passed
Push — master ( 10c999...53978b )
by Alexander
02:49
created

WebViewCollector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 90.91%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 27
ccs 10
cts 11
cp 0.9091
rs 10
wmc 4

3 Methods

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