RefuseGridView::columns()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 19
c 0
b 0
f 0
ccs 0
cts 19
cp 0
rs 9.8333
cc 2
nc 1
nop 0
crap 6
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