Passed
Push — master ( 7ba57e...634515 )
by Paweł
03:13
created

AccountBasicStatColumn   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDataCellValue() 0 10 2
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 16.08.2018
6
 */
7
8
namespace app\modules\admin\components\grid;
9
10
11
use yii\grid\DataColumn;
12
13
class AccountBasicStatColumn extends DataColumn
14
{
15
    public $format = 'raw';
16
    public $dataFormat = 'integer';
17
18
    public function getDataCellValue($model, $key, $index)
19
    {
20
        if ($model->{$this->attribute}) {
21
            return sprintf('<span data-toggle="tooltip" data-placement="top" title="updated at: %s">%s</span>',
22
                $this->grid->formatter->asDate($model->stats_updated_at),
23
                $this->grid->formatter->format($model->{$this->attribute}, $this->dataFormat)
24
            );
25
        }
26
27
        return '';
28
    }
29
}