Completed
Push — master ( 0ab0a7...9c94d9 )
by Andrii
08:14
created

TicketActionsMenu::items()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
ccs 0
cts 15
cp 0
rs 9.2
cc 4
eloc 8
nc 8
nop 0
crap 20
1
<?php
2
3
namespace hipanel\modules\ticket\menus;
4
5
use hipanel\modules\ticket\models\Thread;
6
use hiqdev\menumanager\Menu;
7
use Yii;
8
9
class TicketActionsMenu extends Menu
10
{
11
    public $model;
12
13
    public function items()
14
    {
15
        return [
16
            [
17
                'label' => Yii::t('hipanel', 'View'),
18
                'icon' => 'fa-info',
19
                'url' => ['@ticket/view', 'id' => $this->model->id],
20
            ],
21
            [
22
                'label' => $this->model->state === Thread::STATE_OPEN ? Yii::t('hipanel:ticket', 'Close') : Yii::t('hipanel:ticket', 'Open'),
23
                'icon' => $this->model->state === Thread::STATE_OPEN ? 'fa-times' : 'fa-envelope-open-o',
24
                'url' => $this->model->state === Thread::STATE_OPEN ? ['@ticket/close', 'id' => $this->model->id] : ['@ticket/open', 'id' => $this->model->id],
25
            ],
26
        ];
27
    }
28
}