Completed
Push — master ( 038688...337a7a )
by Klochok
08:41
created

AccountDetailMenu::items()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 0
cts 27
cp 0
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 14
nc 2
nop 0
crap 6
1
<?php
2
3
namespace hipanel\modules\hosting\menus;
4
5
use hiqdev\menumanager\Menu;
6
use Yii;
7
8
class AccountDetailMenu extends Menu
9
{
10
    public $model;
11
12
    public $blockReasons = [];
13
14
    public function items()
15
    {
16
        return [
17
            [
18
                'label' => $this->renderView('_change-password', ['model' => $this->model]),
19
                'encode' => false,
20
            ],
21
            [
22
                'label' => $this->renderView('_manage-ip-restrictions', ['model' => $this->model]),
23
                'encode' => false,
24
            ],
25
            [
26
                'label' => $this->renderView('_mail-settings', ['model' => $this->model]),
27
                'encode' => false,
28
                'visible' => $this->model->canSetMailSettings(),
29
            ],
30
            [
31
                'label' => $this->renderView('_block', ['model' => $this->model, 'blockReasons' => $this->blockReasons]),
32
                'encode' => false,
33
                'visible' => Yii::$app->user->can('support') && Yii::$app->user->id !== $this->model->client_id,
34
            ],
35
            [
36
                'label' => $this->renderView('_delete', ['model' => $this->model]),
37
                'encode' => false,
38
            ],
39
        ];
40
    }
41
42
    public function getViewPath()
43
    {
44
        return '@vendor/hiqdev/hipanel-module-hosting/src/views/account';
45
    }
46
}
47