Mustache   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 36
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1
rs 10
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compiler() 0 6 2
A render() 0 6 1
1
<?php 
2
3
namespace Helmut\Forms\Engines;
4
5
use Helmut\Forms\Engine;
6
use Mustache_Engine;
7
8
class Mustache implements Engine {
9
10
    /**
11
     * The mustache compiler engine.
12
     *
13
     * @var \Mustache_Engine
14
     */ 
15
    protected $compiler;
16
17
    /**
18
     * Fetch the compiler.
19
     *
20
     * @return \Mustache_Engine
21
     */
22 47
    public function compiler()
23
    {
24 47
        if ( ! $this->compiler) $this->compiler = new Mustache_Engine;
25
26 47
        return $this->compiler;
27
    }
28
29
    /**
30
     * Render the template content.
31
     *
32
     * @param  string  $path
33
     * @param  array  $properties
34
     * @return string
35
     */
36 47
    public function render($path, $properties = []) 
37
    {
38 47
        $content = file_get_contents($path);
39
40 47
        return $this->compiler()->render($content, $properties);
41
    }
42
43
}
44