Completed
Push — master ( 8d3e79...9daf84 )
by Edson
04:12
created

Tpl   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A assign() 0 3 1
A engine() 0 7 3
A render() 0 3 1
A config() 0 3 1
1
<?php
2
3
namespace Bonfim;
4
5
use Bonfim\Tpl\Engine;
6
7
class Tpl
8
{
9
    private static $assign = [];
10
    private static $engine = null;
11
12 2
    private static function engine(): Engine
13
    {
14 2
        if (!isset(self::$engine) || is_null(self::$engine)) {
15 2
            self::$engine = new Engine;
16
        }
17
18 2
        return self::$engine;
19
    }
20
21 2
    public static function config(array $config): void
22
    {
23 2
        self::engine()->config($config);
24 2
    }
25
26 2
    public static function assign(string $key, $value): void
27
    {
28 2
        self::$assign[$key] = $value;
29 2
    }
30
31 2
    public static function render(string $template): string
32
    {
33 2
        return self::engine()->render($template, self::$assign);
34
    }
35
}
36