Completed
Push — master ( 9c007b...f6b39d )
by Andrii
15:21
created

SidebarMenu   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 37
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B items() 0 34 3
1
<?php
2
3
/*
4
 * Finance module for HiPanel
5
 *
6
 * @link      https://github.com/hiqdev/hipanel-module-finance
7
 * @package   hipanel-module-finance
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hipanel\modules\finance\menus;
13
14
use Yii;
15
16
class SidebarMenu extends \hiqdev\menumanager\Menu
17
{
18
    public function items()
19
    {
20
        if (Yii::$app->user->can('support') && !Yii::$app->user->can('manage')) {
21
            return [];
22
        }
23
24
        return [
25
            'finance' => [
26
                'label' => Yii::t('hipanel/finance', 'Finance'),
27
                'url'   => ['/finance/bill/index'],
28
                'icon'  => 'fa-dollar',
29
                'items' => [
30
                    'payments' => [
31
                        'label' => Yii::t('hipanel/finance', 'Payments'),
32
                        'url'   => ['/finance/bill/index'],
33
                    ],
34
                    'deposit' => [
35
                        'label' => Yii::t('hipanel/finance', 'Recharge account'),
36
                        'url'   => ['/merchant/pay/deposit'],
37
                    ],
38
                    'tariffs' => [
39
                        'label'   => Yii::t('hipanel/finance', 'Tariffs'),
40
                        'url'     => ['/finance/tariff/index'],
41
                        'visible' => Yii::$app->user->can('support'),
42
                    ],
43
                    'holds' => [
44
                        'label'   => Yii::t('hipanel/finance', 'Held payments'),
45
                        'url'     => ['/finance/held-payments/index'],
46
                        'visible' => Yii::$app->user->can('resell'),
47
                    ],
48
                ],
49
            ],
50
        ];
51
    }
52
}
53