FileSystemRenderTemplate   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 1

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A renderTemplate() 0 9 4
1
<?php
2
3
namespace League\Plates\RenderTemplate;
4
5
use League\Plates;
6
7
final class FileSystemRenderTemplate implements Plates\RenderTemplate
8
{
9
    private $render_sets;
10
11 32
    public function __construct(array $render_sets) {
12 32
        $this->render_sets = $render_sets;
13 32
    }
14
15 32
    public function renderTemplate(Plates\Template $template, Plates\RenderTemplate $rt = null) {
16 32
        foreach ($this->render_sets as list($match, $render)) {
17 28
            if ($match($template)) {
18 28
                return $render->renderTemplate($template, $rt ?: $this);
19
            }
20
        }
21
22 4
        throw new Plates\Exception\RenderTemplateException('No renderer was available for the template: ' . $template->name);
23
    }
24
}
25