src/TwigJs/Compiler/AutoEscapeCompiler.php 1 location
|
@@ 24-41 (lines=18) @@
|
21 |
|
use TwigJs\JsCompiler; |
22 |
|
use TwigJs\TypeCompilerInterface; |
23 |
|
|
24 |
|
class AutoEscapeCompiler implements TypeCompilerInterface |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_AutoEscape'; |
29 |
|
} |
30 |
|
|
31 |
|
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_AutoEscape) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf('$node must be an instanceof of \AutoEscape, but got "%s".', get_class($node)) |
36 |
|
); |
37 |
|
} |
38 |
|
|
39 |
|
$compiler->subcompile($node->getNode('body')); |
40 |
|
} |
41 |
|
} |
42 |
|
|
src/TwigJs/Compiler/Expression/DefaultFilterCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\JsCompiler; |
22 |
|
use TwigJs\TypeCompilerInterface; |
23 |
|
|
24 |
|
class DefaultFilterCompiler implements TypeCompilerInterface |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_DefaultFilter'; |
29 |
|
} |
30 |
|
|
31 |
|
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_DefaultFilter) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_DefaultFilter, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
$compiler->subcompile($node->getNode('node')); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Filter/DefaultCompiler.php 1 location
|
@@ 8-28 (lines=21) @@
|
5 |
|
use TwigJs\JsCompiler; |
6 |
|
use TwigJs\TypeCompilerInterface; |
7 |
|
|
8 |
|
class DefaultCompiler implements TypeCompilerInterface |
9 |
|
{ |
10 |
|
public function getType() |
11 |
|
{ |
12 |
|
return 'Twig_Node_Expression_Filter_Default'; |
13 |
|
} |
14 |
|
|
15 |
|
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node) |
16 |
|
{ |
17 |
|
if (!$node instanceof \Twig_Node_Expression_Filter_Default) { |
18 |
|
throw new \RuntimeException( |
19 |
|
sprintf( |
20 |
|
'$node must be an instanceof of \Twig_Node_Expression_Filter_Default, but got "%s".', |
21 |
|
get_class($node) |
22 |
|
) |
23 |
|
); |
24 |
|
} |
25 |
|
|
26 |
|
$compiler->subcompile($node->getNode('node')); |
27 |
|
} |
28 |
|
} |
29 |
|
|