TplRenderer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRenderer() 0 10 1
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 Twig_Environment;
14
use Twig_Loader_Filesystem;
15
use Twig_Extensions_Extension_Intl;
16
use Twig_Extension_Escaper;
17
18
class TplRenderer {
19
20
    public static function getRenderer($path) {
21
        $loader = new Twig_Loader_Filesystem();
22
        // templates path
23
        $loader->addPath($path);
24
        $renderer = new Twig_Environment($loader, ['cache' => false]);
25
        // I18n ext
26
        $renderer->addExtension(new Twig_Extensions_Extension_Intl());
27
        // Scape html ext
28
        $renderer->addExtension(new Twig_Extension_Escaper('html'));
29
        return $renderer;
30
    }
31
32
}
33