Completed
Push — master ( 3fda55...51e253 )
by Andrii
04:23
created

UserMenu::items()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 26
ccs 0
cts 25
cp 0
rs 8.8571
cc 1
eloc 17
nc 1
nop 0
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 View Code Duplication
    public function render($options = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12
        $defaultOptions = [
13
            'class' => UserMenuWidget::class,
14
            'options' => ['class' => 'sidebar-menu'],
15
        ];
16
17
        return parent::render(array_merge($defaultOptions, $options));
18
    }
19
20
    public function items()
21
    {
22
        return [
23
            'header' => [
24
                'label' => $this->renderView('userMenuHeader'),
25
            ],
26
            'profile' => [
27
                'label' => Yii::t('hipanel', 'Profile'),
28
                'url'   => ['/site/profile'],
29
            ],
30
            'logout' => [
31
                'label' => Yii::t('hipanel', 'Sign out'),
32
                'url'   => ['/site/logout'],
33
            ],
34
35
            'deposit' => [
36
                'label' => Yii::t('hipanel', 'Recharge account'),
37
                'url'   => ['@pay/deposit'],
38
                'visible' => Yii::$app->user->can('deposit'),
39
            ],
40
            'ticket' => [
41
                'label' => Yii::t('hipanel', 'Create ticket'),
42
                'url'   => ['@ticket/create'],
43
            ],
44
        ];
45
    }
46
}
47