Behavior   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0
ccs 0
cts 16
cp 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A events() 0 4 1
A getBuilder() 0 7 2
A onEndBody() 0 3 1
1
<?php
2
/**
3
 * Yandex.Metrika counter for Yii2 applications
4
 *
5
 * @link      https://github.com/hiqdev/yii2-yandex-metrika
6
 * @package   yii2-yandex-metrika
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\yii2\YandexMetrika;
12
13
use Yii;
14
use yii\web\View;
15
16
class Behavior extends \yii\base\Behavior
17
{
18
    public $builder;
19
20
    public function events()
21
    {
22
        return [
23
            View::EVENT_END_BODY => 'onEndBody',
24
        ];
25
    }
26
27
    public function onEndBody($event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
    public function onEndBody(/** @scrutinizer ignore-unused */ $event)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        echo $this->getBuilder()->render();
30
    }
31
32
    public function getBuilder()
33
    {
34
        if (!is_object($this->builder)) {
35
            $this->builder = Yii::createObject($this->builder);
36
        }
37
38
        return $this->builder;
39
    }
40
}
41