Completed
Push — master ( 10273b...44c8cc )
by Michael
02:31
created

functions.php ➔ render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Schnittstabil {
4
5 View Code Duplication
    if (!function_exists('Schnittstabil\curty')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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 View Code Duplication
    if (!function_exists('Schnittstabil\Curty\render')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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