Template::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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