Passed
Push — master ( 46dd23...a76d17 )
by Dmitry
03:18
created

src/widgets/VNCFormatter.php (3 issues)

1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\widgets;
12
13
use Yii;
14
use yii\base\Widget;
15
use yii\db\ActiveRecord;
16
use yii\helpers\Html;
17
use yii\web\View;
18
19
class VNCFormatter extends Widget
20
{
21
    /**
22
     * @var ActiveRecord
23
     */
24
    public $model;
25
26
    public function init()
27
    {
28
        parent::init();
29
    }
30
31
    public function run()
32
    {
33
        $this->getView()->registerJs("$('.discount-popover').popover();", View::POS_READY, 'discount-popover');
34
35
        return Html::tag($this->tagName,
0 ignored issues
show
Bug Best Practice introduced by
The property tagName does not exist on hipanel\modules\server\widgets\VNCFormatter. Since you implemented __get, consider adding a @property annotation.
Loading history...
36
            Yii::$app->formatter->asPercent($this->current / 100),
0 ignored issues
show
Bug Best Practice introduced by
The property current does not exist on hipanel\modules\server\widgets\VNCFormatter. Since you implemented __get, consider adding a @property annotation.
Loading history...
37
            [
38
                'title'        => Yii::t('hipanel:server', 'Next discount'),
39
                'class'        => 'btn btn-default btn-xs discount-popover',
40
                'data-trigger' => 'focus',
41
                'data-content' => Yii::$app->formatter->asPercent($this->next / 100),
0 ignored issues
show
Bug Best Practice introduced by
The property next does not exist on hipanel\modules\server\widgets\VNCFormatter. Since you implemented __get, consider adding a @property annotation.
Loading history...
42
            ]);
43
    }
44
}
45