@@ -32,14 +32,14 @@ public function compile($compiler)
32
32
{
33
33
$ compiler ->addDebugInfo ($ this );
34
34
35
- if ($ this [ 'is_simple ' ] ) {
36
- list ($ msg , $ vars ) = $ this ->compileString ($ this ->body );
35
+ if ($ this -> getAttribute ( 'is_simple ' ) ) {
36
+ list ($ msg , $ vars ) = $ this ->compileString ($ this ->getNode ( ' body ' ) );
37
37
} else {
38
- $ msg = $ this ->body ;
39
- $ vars = $ this ->vars ;
38
+ $ msg = $ this ->getNode ( ' body ' ) ;
39
+ $ vars = $ this ->getNode ( ' vars ' ) ;
40
40
}
41
41
42
- $ method = null === $ this ->count ? 'trans ' : 'transChoice ' ;
42
+ $ method = null === $ this ->getNode ( ' count ' ) ? 'trans ' : 'transChoice ' ;
43
43
44
44
$ compiler
45
45
->write ('echo $this->env->getExtension( \'translator \')->getTranslator()-> ' .$ method .'( ' )
@@ -48,9 +48,9 @@ public function compile($compiler)
48
48
49
49
$ compiler ->raw (', ' );
50
50
51
- if (null !== $ this ->count ) {
51
+ if (null !== $ this ->getNode ( ' count ' ) ) {
52
52
$ compiler
53
- ->subcompile ($ this ->count )
53
+ ->subcompile ($ this ->getNode ( ' count ' ) )
54
54
->raw (', ' )
55
55
;
56
56
}
@@ -74,7 +74,7 @@ public function compile($compiler)
74
74
75
75
$ compiler
76
76
->raw ("), " )
77
- ->subcompile ($ this ->domain )
77
+ ->subcompile ($ this ->getNode ( ' domain ' ) )
78
78
->raw ("); \n" )
79
79
;
80
80
}
@@ -89,14 +89,14 @@ protected function compileString(\Twig_NodeInterface $body)
89
89
$ vars = array ();
90
90
foreach ($ body as $ node ) {
91
91
if ($ node instanceof \Twig_Node_Print) {
92
- $ n = $ node ->expr ;
92
+ $ n = $ node ->getNode ( ' expr ' ) ;
93
93
while ($ n instanceof \Twig_Node_Expression_Filter) {
94
- $ n = $ n ->node ;
94
+ $ n = $ n ->getNode ( ' node ' ) ;
95
95
}
96
- $ msg .= sprintf ('{{ %s }} ' , $ n[ 'name ' ] );
97
- $ vars [] = new \Twig_Node_Expression_Name ($ n[ 'name ' ] , $ n ->getLine ());
96
+ $ msg .= sprintf ('{{ %s }} ' , $ n-> getAttribute ( 'name ' ) );
97
+ $ vars [] = new \Twig_Node_Expression_Name ($ n-> getAttribute ( 'name ' ) , $ n ->getLine ());
98
98
} else {
99
- $ msg .= $ node[ 'data ' ] ;
99
+ $ msg .= $ node-> getAttribute ( 'data ' ) ;
100
100
}
101
101
}
102
102
0 commit comments