TemplateMgr   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTpl() 0 6 2
1
<?php
2
3
/**
4
 * MÓDULO DE EMISIÓN ELECTRÓNICA F72X
5
 * UBL 2.1
6
 * Version 1.0
7
 * 
8
 * Copyright 2019, Jaime Cruz
9
 */
10
11
namespace F72X\Tools;
12
13
use jDelta\StringMax;
14
15
class TemplateMgr {
16
17
    /**
18
     * 
19
     * @param string $tplName Nombre de archivo dentro del directorio templates/
20
     * @param array $data Data a ser remplazada en la plantilla
21
     * 
22
     * @return string
23
     */
24
    public static function getTpl($tplName, $data = null) {
25
        $tpl = file_get_contents(__DIR__ . "/../templates/$tplName");
26
        if ($data) {
27
            return StringMax::replaceTokens($tpl, $data);
28
        }
29
        return $tpl;
30
    }
31
32
}
33