CrontabGridView   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 40
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 37 1
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\grid;
12
13
use hipanel\modules\hosting\menus\CrontabActionsMenu;
14
use hipanel\modules\server\grid\ServerColumn;
15
use hiqdev\yii2\menus\grid\MenuColumn;
16
use Yii;
17
use yii\helpers\Html;
18
19
class CrontabGridView extends \hipanel\grid\BoxedGridView
20
{
21
    public function columns()
22
    {
23
        return array_merge(parent::columns(), [
24
            'crontab' => [
25
                'attribute' => 'crontab',
26
                'format' => 'html',
27
                'enableSorting' => false,
28
                'value' => function ($model, $key, $index) {
0 ignored issues
show
Unused Code introduced by
The parameter $index is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
                    $label = Yii::t('hipanel:hosting', '{0, plural, one{# record} other{# records}}', $model->cronRecordCount);
30
31
                    return Html::a($label, ['view', 'id' => $key], ['class' => 'bold', 'data-pjax' => 0]);
32
                },
33
            ],
34
            'server' => [
35
                'sortAttribute' => 'server',
36
                'attribute' => 'server_id',
37
                'class' => ServerColumn::class,
38
            ],
39
            'account' => [
40
                'sortAttribute' => 'account',
41
                'attribute' => 'account_id',
42
                'class' => AccountColumn::class,
43
            ],
44
            'client',
45
            'state' => [
46
                'enableSorting' => false,
47
                'attribute' => 'state',
48
                'value' => function ($model) {
49
                    return Yii::t('hipanel:hosting:cron:states', $model->state);
50
                },
51
            ],
52
            'actions' => [
53
                'class' => MenuColumn::class,
54
                'menuClass' => CrontabActionsMenu::class,
55
            ],
56
        ]);
57
    }
58
}
59