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

AbstractBufferNode   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getContextVariableName() 0 4 1
A getExecutionPriority() 0 8 2
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