Completed
Push — master ( 0ed20a...7babd4 )
by Nikola
03:05
created

AbstractBufferNode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 5
crap 1
1
<?php
2
/*
3
 * This file is part of the Twig Bufferized Template package, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\Twig\BufferizedTemplate\Tag\TemplateBuffer;
11
12
/**
13
 * Class AbstractBufferNode
14
 *
15
 * Base buffer node containing base methods and settings.
16
 *
17
 * @package RunOpenCode\Twig\BufferizedTemplate\Tag\TemplateBuffer
18
 *
19
 * @internal
20
 */
21
abstract class AbstractBufferNode extends \Twig_Node
22
{
23
    /**
24
     * Default execution priority
25
     *
26
     * @var int
27
     */
28
    private $defaultExecutionPriority;
29
30
    /**
31
     * AbstractBufferNode constructor.
32
     *
33
     * @param int $defaultExecutionPriority
34
     * @param array $nodes
35
     * @param array $attributes
36
     * @param int $lineno
37
     * @param null|string $tag
38
     */
39 3
    public function __construct($defaultExecutionPriority, array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
40
    {
41 3
        $this->defaultExecutionPriority = $defaultExecutionPriority;
42 3
        parent::__construct($nodes, $attributes, $lineno, $tag);
43 3
    }
44
45
    /**
46
     * Get context random variable name.
47
     *
48
     * @return string
49
     */
50 2
    public function getContextVariableName()
51
    {
52 2
        return '$_________runopencode_twig_bufferized_template_environment_variable_______iByUtNtcGcwrjomGoxjFQNuKmmOSVpZjLuKersvpdImnPTfXsCrfWXNrkpTV';
53
    }
54
55
    /**
56
     * Get execution priority.
57
     *
58
     * @return int
59
     */
60 2
    public function getExecutionPriority()
61
    {
62 2
        if ($this->hasAttribute('bufferized_execution_priority')) {
63 2
            return $this->getAttribute('bufferized_execution_priority');
64
        }
65
66 2
        return $this->defaultExecutionPriority;
67
    }
68
}
69