CStatic   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
c 0
b 0
f 0
dl 0
loc 20
rs 10
ccs 9
cts 9
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 3 2
A returnWithClass() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
namespace kalanis\kw_table\core\Table\Columns;
4
5
6
use kalanis\kw_connect\core\Interfaces\IRow;
7
8
9
/**
10
 * Class CStatic
11
 * @package kalanis\kw_table\core\Table\Columns
12
 * Static value defined on init
13
 */
14
class CStatic extends AColumn
15
{
16
    private string $value = '';
17
    private string $class = '';
18
19 2
    public function __construct(string $value, string $class = '', string $sourceName = '')
20
    {
21 2
        $this->value = $value;
22 2
        $this->class = $class;
23 2
        $this->sourceName = $sourceName;
24 2
    }
25
26 2
    public function getValue(IRow $source)
27
    {
28 2
        return !empty($this->class) ? $this->returnWithClass() : $this->value;
29
    }
30
31 1
    private function returnWithClass(): string
32
    {
33 1
        return '<span class="' . $this->class . '">' . $this->value . '</span>';
34
    }
35
}
36