MinifyHtmlNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace voku\twig;
4
5
use Twig\Compiler;
6
use Twig\Node\Node;
7
8
class MinifyHtmlNode extends Node
9
{
10
    /**
11
     * MinifyHtmlNode constructor.
12
     *
13
     * @param array $nodes
14
     * @param array $attributes
15
     * @param int   $lineno
16
     * @param null  $tag
17
     */
18 2
    public function __construct(array $nodes = [], array $attributes = [], $lineno = 0, $tag = null)
19
    {
20 2
        parent::__construct($nodes, $attributes, $lineno, $tag);
21 2
    }
22
23
    /**
24
     * @param Compiler $compiler
25
     */
26 2
    public function compile(Compiler $compiler)
27
    {
28
        $compiler
29 2
            ->addDebugInfo($this)
30 2
            ->write("ob_start();\n")
31 2
            ->subcompile($this->getNode('body'))
32 2
            ->write('$extension = $this->env->getExtension(\'\\voku\\twig\\MinifyHtmlExtension\');' . "\n")
33 2
            ->write('echo $extension->compress($this->env, ob_get_clean());' . "\n");
34 2
    }
35
}
36