Completed
Push — master ( 53c186...c8eb44 )
by Andrii
04:15
created

UserMenu::widget()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
ccs 0
cts 1
cp 0
rs 9.6666
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace hipanel\menus;
4
5
use hiqdev\thememanager\widgets\UserMenu as UserMenuWidget;
6
use Yii;
7
8
class UserMenu extends \hiqdev\menumanager\Menu
9
{
10
    public $widgetConfig = [
11
        'class' => UserMenuWidget::class,
12
    ];
13
14
    public $options = [
15
        'class' => 'sidebar-menu',
16
    ];
17
18
    public function items()
19
    {
20
        return [
21
            'header' => [
22
                'label' => $this->render('userMenuHeader'),
23
            ],
24
            'profile' => [
25
                'label' => Yii::t('hipanel', 'Profile'),
26
                'url'   => ['/site/profile'],
27
            ],
28
            'logout' => [
29
                'label' => Yii::t('hipanel', 'Sign out'),
30
                'url'   => ['/site/logout'],
31
            ],
32
33
            'deposit' => [
34
                'label' => Yii::t('hipanel', 'Recharge account'),
35
                'url'   => ['@pay/deposit'],
36
                'visible' => Yii::$app->user->can('deposit'),
37
            ],
38
            'ticket' => [
39
                'label' => Yii::t('hipanel', 'Create ticket'),
40
                'url'   => ['@ticket/create'],
41
            ],
42
        ];
43
    }
44
}
45