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

AccountBasicStatColumn::getDataCellValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 3
dl 0
loc 10
rs 10
c 0
b 0
f 0
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
}