MinifyHtmlNode   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A compile() 0 9 1
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