CssNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Braunstetter\AssetsPushBundle\Twig\Nodes;
4
5
use Twig\Node\Node;
6
use Twig\Compiler;
7
8
class CssNode extends Node
9
{
10
11
    public function __construct(string $data, int $lineno = 0, string $tag = null)
12
    {
13
        parent::__construct([], ['data' => $data], $lineno, $tag);
14
    }
15
16
    public function compile(Compiler $compiler)
17
    {
18
19
        $compiler
20
            ->write(sprintf('$extension = $this->extensions["%s"];', 'Braunstetter\\AssetsPushBundle\\Twig\\Extension'))
21
            ->write('$extension->registerCss("' . $this->getAttribute('data') . '");');
22
23
//        $compiler
24
//            ->write('if (!isset(' . static::BASE_ARRAY_PATH . ')) { ' . static::BASE_ARRAY_PATH . ' = []; }')
25
//            ->raw(";\n");
26
//
27
//        $compiler
28
//            ->write('if (!isset(' . static::FULL_ARRAY_PATH . ')) { ' . static::FULL_ARRAY_PATH . ' = []; }')
29
//            ->raw(";\n");
30
//
31
//        // merge the data provided in this template with the existing data
32
//        $compiler
33
//            ->write(static::FULL_ARRAY_PATH . '= array_merge(' . static::FULL_ARRAY_PATH . ', ')
34
//            ->repr([$this->getAttribute('data')])
35
//            ->raw(");\n");
36
37
    }
38
39
40
}