Sprintf   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 15
rs 10
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 3 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 Sprintf
11
 * @package kalanis\kw_table\core\Table\Columns
12
 * Add value into pre-formatted content
13
 */
14
class Sprintf extends AColumn
15
{
16
    use TEscapedValue;
17
18
    protected string $format = '';
19
20 1
    public function __construct(string $sourceName, string $format)
21
    {
22 1
        $this->sourceName = $sourceName;
23 1
        $this->format = $format;
24 1
    }
25
26 1
    public function getValue(IRow $source)
27
    {
28 1
        return sprintf($this->format, $this->valueEscape(parent::getValue($source)));
29
    }
30
}
31