Completed
Push — master ( 1a3ff8...fe80fb )
by Nikola
02:47
created

BreakPoint::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 10
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
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 BreakPoint
14
 *
15
 * Terminate previous buffer and start new one.
16
 *
17
 * @package RunOpenCode\Twig\BufferizedTemplate\Tag\TemplateBuffer
18
 *
19
 * @internal
20
 */
21 View Code Duplication
final class BreakPoint extends \Twig_Node
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 4
    public function compile(\Twig_Compiler $compiler)
27
    {
28
        $compiler
29 4
            ->write(sprintf('}, $this), %s);', $this->getAttribute('execution_priority')))
30 4
            ->write("\n");
31
32
        $compiler
33 4
            ->write(sprintf('%s->bufferize(Closure::bind(function() use (&$context, &$blocks) { ', $this->getAttribute('bufferized_context_variable_name')))
34 4
            ->write("\n");
35 4
    }
36
}
37