Completed
Push — master ( 9fa729...e15551 )
by Dmitry
13:25
created

PreOrderGridView::columns()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 0
cts 34
cp 0
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 24
nc 1
nop 0
crap 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-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\grid;
12
13
use hipanel\grid\ActionColumn;
14
use hipanel\modules\server\helpers\ServerHelper;
15
use hipanel\modules\server\widgets\OSFormatter;
16
use Yii;
17
18
class PreOrderGridView extends \hipanel\grid\BoxedGridView
19
{
20
    protected function columns()
21
    {
22
        return array_merge(parent::columns(), [
0 ignored issues
show
Bug introduced by
The method columns() does not exist on hipanel\grid\BoxedGridView. Did you maybe mean column()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
23
            'tech_details' => [
24
                'format' => 'raw',
25
                'label' => Yii::t('hipanel:finance:change', 'Operation details'),
26
                'value' => function ($model) {
27
                    $params = $model->params;
28
                    return OSFormatter::widget([
29
                        'osimages' => ServerHelper::getOsimages($params['tariff_type']),
30
                        'imageName' => $params['osimage'],
31
                        'infoCircle' => false,
32
                    ]);
33
                },
34
            ],
35
            'user_comment' => [
36
                'filterAttribute' => 'user_comment_like',
37
                'value' => function ($model) {
38
                    return $model->user_comment;
39
                },
40
            ],
41
            'tech_comment' => [
42
                'attribute' => 'tech_comment',
43
            ],
44
            'time' => [
45
                'value' => function ($model) {
46
                    return Yii::$app->formatter->asDatetime($model->time);
47
                },
48
            ],
49
            'actions' => [
50
                'class' => ActionColumn::class,
51
                'template' => '{view}',
52
                'header' => Yii::t('hipanel', 'Actions'),
53
            ],
54
        ]);
55
    }
56
}
57