Completed
Push — master ( dd07d1...716d70 )
by Andrii
04:48
created

SidebarMenu   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 0
cbo 2
dl 0
loc 54
ccs 0
cts 45
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A items() 0 51 3
1
<?php
2
/**
3
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\menus;
12
13
use Yii;
14
15
class SidebarMenu extends \hiqdev\yii2\menus\Menu
16
{
17
    public function items()
18
    {
19
        $user = Yii::$app->user;
20
        if (!$user->can('manage') && !$user->can('deposit')) {
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
                        'visible' => $user->can('deposit'),
38
                    ],
39
                    'tariffs' => [
40
                        'label'   => Yii::t('hipanel:finance', 'Tariffs'),
41
                        'url'     => ['/finance/tariff/index'],
42
                        'visible' => $user->can('manage'),
43
                    ],
44
                    'requisites' => [
45
                        'label'   => Yii::t('hipanel:finance', 'Requisites'),
46
                        'url'     => ['/finance/bill/requisites'],
47
                        'visible' => $user->can('manage'),
48
                    ],
49
                    'holds' => [
50
                        'label'   => Yii::t('hipanel:finance', 'Held payments'),
51
                        'url'     => ['/finance/held-payments/index'],
52
                        'visible' => $user->can('resell'),
53
                    ],
54
                    'sale' => [
55
                        'label'   => Yii::t('hipanel:finance:sale', 'Sale'),
56
                        'url'     => ['/finance/sale/index'],
57
                        'visible' => $user->can('manage'),
58
                    ],
59
                    'generate' => [
60
                        'label'   => Yii::t('hipanel:finance', 'Generate documents'),
61
                        'url'     => ['/finance/purse/generate-all'],
62
                        'visible' => $user->can('document.generate-all'),
63
                    ],
64
                ],
65
            ],
66
        ];
67
    }
68
}
69