RefuseGridView   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 1
b 0
f 0
dl 0
loc 21
ccs 0
cts 19
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 19 2
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\grid;
12
13
use Yii;
14
15
class RefuseGridView extends \hipanel\grid\BoxedGridView
16
{
17
    public function columns()
18
    {
19
        return array_merge(parent::columns(), [
20
            'user_comment' => [
21
                'filterAttribute' => 'user_comment_like',
22
                'value' => function ($model) {
23
                    return $model->user_comment;
24
                },
25
            ],
26
            'server' => [
27
                'label' => Yii::t('hipanel:server', 'Server'),
28
                'value' => function ($model) {
29
                    return $model->params['name'] ?: $model->params['server'];
30
                },
31
            ],
32
            'time' => [
33
                'filter' => false,
34
                'value' => function ($model) {
35
                    return Yii::$app->formatter->asDatetime($model->time);
36
                },
37
            ],
38
        ]);
39
    }
40
}
41