PluginTopLevelBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 3 1
A preProcessing() 0 4 1
A postProcessing() 0 4 1
1
<?php
2
/**
3
 * Copyright (c) 2013-2016
4
 *
5
 * @category  Library
6
 * @package   Dwoo\Plugins\Blocks
7
 * @author    Jordi Boggiano <[email protected]>
8
 * @author    David Sanchez <[email protected]>
9
 * @copyright 2008-2013 Jordi Boggiano
10
 * @copyright 2013-2016 David Sanchez
11
 * @license   http://dwoo.org/LICENSE Modified BSD License
12
 * @version   1.3.0
13
 * @date      2016-09-19
14
 * @link      http://dwoo.org/
15
 */
16
17
namespace Dwoo\Plugins\Blocks;
18
19
use Dwoo\Compiler;
20
use Dwoo\Block\Plugin as BlockPlugin;
21
use Dwoo\ICompilable\Block as ICompilableBlock;
22
23
/**
24
 * Internal plugin used to wrap the template output, do not use in your templates as it will break them.
25
 * This software is provided 'as-is', without any express or implied warranty.
26
 */
27
final class PluginTopLevelBlock extends BlockPlugin implements ICompilableBlock
28
{
29
    public function init()
30
    {
31
    }
32
33
    /**
34
     * @param Compiler $compiler
35
     * @param array    $params
36
     * @param string   $prepend
37
     * @param string   $append
38
     * @param string   $type
39
     *
40
     * @return string
41
     */
42
    public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type)
43
    {
44
        return '/* end template head */ ob_start(); /* template body */ ' . Compiler::PHP_CLOSE;
45
    }
46
47
    /**
48
     * @param Compiler $compiler
49
     * @param array    $params
50
     * @param string   $prepend
51
     * @param string   $append
52
     * @param string   $content
53
     *
54
     * @return string
55
     */
56
    public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content)
57
    {
58
        return $content . Compiler::PHP_OPEN . ' /* end template body */' . "\n" . 'return $this->buffer . ob_get_clean();';
59
    }
60
}
61