Completed
Push — extensions ( 84a6ae )
by
unknown
22:00 queued 07:01
created

FileSystemRenderTemplate   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 18
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
    public function __construct(array $render_sets) {
12
        $this->render_sets = $render_sets;
13
    }
14
15
    public function renderTemplate(Plates\Template $template, Plates\RenderTemplate $rt = null) {
16
        foreach ($this->render_sets as list($match, $render)) {
17
            if ($match($template)) {
18
                return $render->renderTemplate($template, $rt ?: $this);
19
            }
20
        }
21
22
        throw new Plates\Exception\RenderTemplateException('No renderer was available for the template: ' . $template->name);
23
    }
24
}
25