TemplateHelper::render()   A
last analyzed

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
    * @param array<int|string,mixed> $data
11
    */
12
    public static function render(string $templatePath, string $templateName, array $data): string
13
    {
14
        $output = new \WebServCo\Framework\Libraries\HtmlOutput();
15
        foreach ($data as $k => $v) {
16
            $output->setData($k, $v);
17
        }
18
        $output->setPath($templatePath);
19
20
        $output->setTemplate($templateName);
21
        return $output->render();
22
    }
23
}
24