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

WebViewCollector::collect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

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 6
cts 7
cp 0.8571
crap 2.0116
rs 10
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