Completed
Push — master ( a2d719...4531d5 )
by Radu
07:41
created

TemplateHelper::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 10
rs 10
cc 2
nc 2
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WebServCo\Framework\Helpers;
6
7
class TemplateHelper
8
{
9
10
    /**
11
    * @param array<int|string,mixed> $data
12
    */
13
    public static function render(string $templatePath, string $templateName, array $data): string
14
    {
15
        $output = new \WebServCo\Framework\Libraries\HtmlOutput();
16
        foreach ($data as $k => $v) {
17
            $output->setData($k, $v);
18
        }
19
        $output->setPath($templatePath);
20
21
        $output->setTemplate($templateName);
22
        return $output->render();
23
    }
24
}
25