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

TicketActionsMenu   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 20
ccs 0
cts 15
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A items() 0 15 4
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
}