4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Bridge\Twig\Tests\NodeVisitor
;
14 use Symfony\Bridge\Twig\Node\TransDefaultDomainNode
;
15 use Symfony\Bridge\Twig\Node\TransNode
;
17 class TwigNodeProvider
19 public static function getModule($content)
21 return new \
Twig_Node_Module(
22 new \
Twig_Node_Expression_Constant($content, 0),
24 new \
Twig_Node_Expression_Array(array(), 0),
25 new \
Twig_Node_Expression_Array(array(), 0),
26 new \
Twig_Node_Expression_Array(array(), 0),
32 public static function getTransFilter($message, $domain = null)
34 $arguments = $domain ? array(
35 new \
Twig_Node_Expression_Array(array(), 0),
36 new \
Twig_Node_Expression_Constant($domain, 0),
39 return new \
Twig_Node_Expression_Filter(
40 new \
Twig_Node_Expression_Constant($message, 0),
41 new \
Twig_Node_Expression_Constant('trans', 0),
42 new \
Twig_Node($arguments),
47 public static function getTransChoiceFilter($message, $domain = null)
49 $arguments = $domain ? array(
50 new \
Twig_Node_Expression_Constant(0, 0),
51 new \
Twig_Node_Expression_Array(array(), 0),
52 new \
Twig_Node_Expression_Constant($domain, 0),
55 return new \
Twig_Node_Expression_Filter(
56 new \
Twig_Node_Expression_Constant($message, 0),
57 new \
Twig_Node_Expression_Constant('transchoice', 0),
58 new \
Twig_Node($arguments),
63 public static function getTransTag($message, $domain = null)
66 new \
Twig_Node_Body(array(), array('data' => $message)),
67 $domain ? new \
Twig_Node_Expression_Constant($domain, 0) : null
71 public static function getTransDefaultDomainTag($domain)
73 return new TransDefaultDomainNode(
74 new \
Twig_Node_Expression_Constant($domain, 0)