Completed
Push — v4.0-dev ( b01e70 )
by
unknown
01:53
created

LayoutRenderTemplate::renderTemplate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 1
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace League\Plates\RenderTemplate;
4
5
use League\Plates;
6
7
class LayoutRenderTemplate implements Plates\RenderTemplate
8
{
9
    private $render;
10
11
    public function __construct(RenderTemplate $render) {
12
        $this->render = $render;
13
    }
14
15
    public function renderTemplate(Plates\Template $template) {
16
        $content = $this->render->renderTemplate($template);
17
18
        $layout = Plates\Template\getLayout($template);
19
        if (!$layout) {
20
            return $content;
21
        }
22
23
        Plates\Template\getSections($layout)->add('content', $content);
24
25
        return $this->renderTemplate($layout);
26
    }
27
}
28