functions.php ➔ render()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Schnittstabil {
4
5
    if (!function_exists('Schnittstabil\curty')) {
6
        /**
7
         * Render template until a fixed point is reached.
8
         *
9
         * @param string       $tpl Curty template
10
         * @param object|array $ctx Context (variable lookup table)
11
         *
12
         * @return string
13
         */
14
        function curty(string $tpl, $ctx) : string
15
        {
16
            static $curty = null;
17
18
            if ($curty === null) {
19
                $curty = new Curty\Renderer();
20
            }
21
22
            return $curty($tpl, $ctx);
23
        }
24
    }
25
}
26
27
namespace Schnittstabil\Curty {
28
29
    if (!function_exists('Schnittstabil\Curty\render')) {
30
        /**
31
         * Render template.
32
         *
33
         * @param string       $tpl Curty template
34
         * @param object|array $ctx Context (variable lookup table)
35
         *
36
         * @return string
37
         */
38
        function render(string $tpl, $ctx) : string
39
        {
40
            static $curty = null;
41
42
            if ($curty === null) {
43
                $curty = new Renderer();
44
            }
45
46
            return $curty->render($tpl, $ctx);
47
        }
48
    }
49
}
50