Code Duplication    Length = 12-12 lines in 2 locations

src/grid/BillGridView.php 1 location

@@ 37-48 (lines=12) @@
34
                'format' => 'html',
35
                'filter' => false,
36
                'contentOptions' => ['class' => 'text-nowrap'],
37
                'value' => function ($model) {
38
                    list($date, $time) = explode(' ', $model->time, 2);
39
40
                    if (in_array($model->gtype, [
41
                        'discount', 'domain', 'monthly', 'overuse', 'premium_package',
42
                        'feature', 'intercept', 'periodic',
43
                    ], true)) {
44
                        return Yii::$app->formatter->asDate($date, 'LLLL y');
45
                    }
46
47
                    return $time === '00:00:00' ? Yii::$app->formatter->asDate($date) : Yii::$app->formatter->asDateTime($model->time);
48
                },
49
            ],
50
            'sum' => [
51
                'class' => CurrencyColumn::class,

src/grid/ChargeGridView.php 1 location

@@ 60-71 (lines=12) @@
57
                'filter' => false,
58
                'enableSorting' => false,
59
                'contentOptions' => ['class' => 'text-nowrap'],
60
                'value' => function ($model) {
61
                    list($date, $time) = explode(' ', $model->time, 2);
62
63
                    if (in_array($model->type, [
64
                        'discount', 'domain', 'monthly', 'overuse', 'premium_package',
65
                        'feature', 'intercept', 'periodic',
66
                    ], true)) {
67
                        return Yii::$app->formatter->asDate($date, 'LLLL y');
68
                    }
69
70
                    return $time === '00:00:00' ? Yii::$app->formatter->asDate($date) : Yii::$app->formatter->asDateTime($model->time);
71
                },
72
            ],
73
        ];
74
    }