| 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
|
|||
| 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 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.