TariffGridView   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 27
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 24 2
1
<?php
2
/**
3
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\grid;
12
13
use hipanel\grid\RefColumn;
14
use hipanel\helpers\Url;
15
use Yii;
16
17
class TariffGridView extends \hipanel\grid\BoxedGridView
18
{
19
    public function columns()
20
    {
21
        return array_merge(parent::columns(), [
22
            'tariff' => [
23
                'class' => 'hipanel\grid\MainColumn',
24
                'filterAttribute' => 'tariff_like',
25
                'note' => Yii::$app->user->can('tariff.update') ? 'note' : null,
26
                'noteOptions' => [
27
                    'url' => Url::to('set-note'),
28
                ],
29
            ],
30
            'used' => [
31
                'filter' => false,
32
            ],
33
            'type' => [
34
                'class' => RefColumn::class,
35
                'i18nDictionary' => 'hipanel:finance:tariff:types',
36
                'gtype' => 'type,tariff',
37
                'value' => function ($model) {
38
                    return Yii::t('hipanel:finance:tariff:types', $model->type);
39
                },
40
            ],
41
        ]);
42
    }
43
}
44