Template   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
c 0
b 0
f 0
dl 0
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 5 1
A __construct() 0 3 1
A setTemplatePath() 0 3 1
1
<?php
2
3
namespace kalanis\kw_table\output_direct;
4
5
6
use kalanis\kw_table\core\Table;
7
8
9
/**
10
 * Class Template
11
 * @package kalanis\kw_table\output_direct
12
 * Flush table into template
13
 */
14
class Template implements ITemplate
15
{
16
    protected string $templatePath = '';
17
18
    public function __construct()
19
    {
20
        $this->templatePath = __DIR__ . '/../shared-templates/table.phtml';
21
    }
22
23
    public function setTemplatePath(string $templatePath): void
24
    {
25
        $this->templatePath = $templatePath;
26
    }
27
28
    public function render(Table $table): string
29
    {
30
        ob_start();
31
        include($this->templatePath);
32
        return strval(ob_get_clean());
33
    }
34
}
35