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

LayoutSectionsExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 23 1
1
<?php
2
3
namespace League\Plates\Extension\LayoutSections;
4
5
use League\Plates;
6
use League\Plates\Extension\RenderContext;
7
8
final class LayoutSectionsExtension implements Plates\Extension
9
{
10
    public function register(Plates\Engine $plates) {
11
        $c = $plates->getContainer();
12
13
        $c->wrap('compose', function($compose, $c) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
            return Plates\Util\compose($compose, sectionsCompose());
15
        });
16
        $c->wrap('renderTemplate.factories', function($factories) {
17
            $factories[] = LayoutRenderTemplate::factory();
18
            return $factories;
19
        });
20
        $c->wrap('renderContext.func.funcs', function($funcs, $c) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
            $template_args = RenderContext\assertTemplateArgsFunc();
22
            $one_arg = RenderContext\assertArgsFunc(1);
23
24
            return array_merge($funcs, [
25
                'layout' => [$template_args, layoutFunc()],
26
                'section' => [$one_arg, sectionFunc()],
27
                'start' => [$one_arg, startFunc()],
28
                'push' => [$one_arg, startFunc(START_APPEND)],
29
                'unshift' => [$one_arg, startFunc(START_PREPEND)],
30
            ]);
31
        });
32
    }
33
}
34