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

LayoutRenderTemplate   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderTemplate() 0 14 4
1
<?php
2
3
namespace League\Plates\Extension\LayoutSections;
4
5
use League\Plates;
6
7
final class LayoutRenderTemplate extends Plates\RenderTemplate\RenderTemplateDecorator
8
{
9
    public function renderTemplate(Plates\Template $template, Plates\RenderTemplate $rt = null) {
10
        $ref = $template->reference;
11
        $content = $this->render->renderTemplate($template, $rt ?: $this);
12
13
        $layout_ref = $ref()->get('layout');
14
        if (!$layout_ref) {
15
            return $content;
16
        }
17
18
        $layout = $layout_ref()->with('sections', $ref()->get('sections'));
19
        $layout->get('sections')->add('content', $content);
20
21
        return ($rt ?: $this)->renderTemplate($layout);
22
    }
23
}
24
25
26