Completed
Push — master ( c12a53...9bcb4f )
by Andrii
04:14
created

DashboardItem::items()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 10
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Domain plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-domain
6
 * @package   hipanel-module-domain
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\ticket\menus;
12
13
use hipanel\modules\dashboard\DashboardInterface;
14
use Yii;
15
16
class DashboardItem extends \hiqdev\yii2\menus\Menu
17
{
18
    protected $dashboard;
19
20
    public function __construct(DashboardInterface $dashboard, $config = [])
21
    {
22
        $this->dashboard = $dashboard;
23
        parent::__construct($config);
24
    }
25
26
    public function items()
27
    {
28
        return [
29
            'tickets' => [
30
                'label' => $this->render('dashboardItem', $this->dashboard->mget(['totalCount','model'])),
31
                'encode' => false,
32
                'visible' => Yii::$app->user->can('ticket.read'),
33
            ],
34
        ];
35
    }
36
}
37