ComposeRenderTemplate::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace League\Plates\RenderTemplate;
4
5
use League\Plates;
6
7
final class ComposeRenderTemplate extends RenderTemplateDecorator
8
{
9
    private $compose;
10
11 24
    public function __construct(Plates\RenderTemplate $render, callable $compose) {
12 24
        parent::__construct($render);
13 24
        $this->compose = $compose;
14 24
    }
15
16 24
    public function renderTemplate(Plates\Template $template, Plates\RenderTemplate $rt = null) {
17 24
        return $this->render->renderTemplate(($this->compose)($template), $rt ?: $this);
18
    }
19
}
20