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

DashboardItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 21
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A items() 0 10 1
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