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

LayoutRenderTemplate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
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