Code Duplication    Length = 12-12 lines in 2 locations

src/grid/BillGridView.php 1 location

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

src/grid/ChargeGridView.php 1 location

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