Completed
Branch master (e379bd)
by Pierre-Henry
33:06
created

Smarty_Internal_Compile_Block_Child::compile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 3
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Smarty.
4
 *
5
 * (c) 2015 Uwe Tews
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
/**
12
 * Smarty Internal Plugin Compile Block Parent Class
13
 *
14
 * @author Uwe Tews <[email protected]>
15
 */
16
class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_CompileBase
17
{
18
    /**
19
     * Attribute definition: Overwrites base class.
20
     *
21
     * @var array
22
     * @see Smarty_Internal_CompileBase
23
     */
24
    public $option_flags = array();
25
26
    /**
27
     * Saved compiler object
28
     *
29
     * @var Smarty_Internal_TemplateCompilerBase
30
     */
31
    public $compiler = null;
32
33
    /**
34
     * Compiles code for the {block_parent} tag
35
     *
36
     * @param  array                                 $args      array with attributes from parser
37
     * @param  \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
38
     * @param  array                                 $parameter array with compilation parameter
39
     *
40
     * @return bool true
41
     */
42
    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
0 ignored issues
show
Unused Code introduced by
The parameter $args 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...
Unused Code introduced by
The parameter $parameter 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...
43
    {
44
        if (!isset($compiler->_cache[ 'blockNesting' ])) {
45
            $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',
46
                                              $compiler->parser->lex->taglineno);
47
        }
48
        $compiler->has_code = true;
49
        $compiler->suppressNocacheProcessing = true;
50
        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
51
        $output = "<?php \n\$_smarty_tpl->inheritance->callChild(\$_smarty_tpl, \$this);\n?>\n";
52
        return $output;
53
    }
54
}