@@ 21-49 (lines=29) @@ | ||
18 | /** |
|
19 | * @author Tobias Nyholm <[email protected]> |
|
20 | */ |
|
21 | final class TranslationBlock extends BaseVisitor implements \Twig_NodeVisitorInterface |
|
22 | { |
|
23 | /** |
|
24 | * @var WorkerTranslationBlock |
|
25 | */ |
|
26 | private $worker; |
|
27 | ||
28 | public function __construct() |
|
29 | { |
|
30 | $this->worker = new WorkerTranslationBlock(); |
|
31 | } |
|
32 | ||
33 | public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) |
|
34 | { |
|
35 | return $this->worker->work($node, $this->collection, function () { |
|
36 | return $this->getAbsoluteFilePath(); |
|
37 | }); |
|
38 | } |
|
39 | ||
40 | public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) |
|
41 | { |
|
42 | return $node; |
|
43 | } |
|
44 | ||
45 | public function getPriority() |
|
46 | { |
|
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |
@@ 21-49 (lines=29) @@ | ||
18 | /** |
|
19 | * @author Tobias Nyholm <[email protected]> |
|
20 | */ |
|
21 | final class TranslationFilter extends BaseVisitor implements \Twig_NodeVisitorInterface |
|
22 | { |
|
23 | /** |
|
24 | * @var WorkerTranslationFilter |
|
25 | */ |
|
26 | private $worker; |
|
27 | ||
28 | public function __construct() |
|
29 | { |
|
30 | $this->worker = new WorkerTranslationFilter(); |
|
31 | } |
|
32 | ||
33 | public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) |
|
34 | { |
|
35 | return $this->worker->work($node, $this->collection, function () { |
|
36 | return $this->getAbsoluteFilePath(); |
|
37 | }); |
|
38 | } |
|
39 | ||
40 | public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) |
|
41 | { |
|
42 | return $node; |
|
43 | } |
|
44 | ||
45 | public function getPriority() |
|
46 | { |
|
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |
@@ 21-49 (lines=29) @@ | ||
18 | /** |
|
19 | * @author Tobias Nyholm <[email protected]> |
|
20 | */ |
|
21 | final class Twig2TranslationBlock extends BaseVisitor implements \Twig_NodeVisitorInterface |
|
22 | { |
|
23 | /** |
|
24 | * @var WorkerTranslationBlock |
|
25 | */ |
|
26 | private $worker; |
|
27 | ||
28 | public function __construct() |
|
29 | { |
|
30 | $this->worker = new WorkerTranslationBlock(); |
|
31 | } |
|
32 | ||
33 | public function enterNode(Twig_Node $node, Twig_Environment $env) |
|
34 | { |
|
35 | return $this->worker->work($node, $this->collection, function () { |
|
36 | return $this->getAbsoluteFilePath(); |
|
37 | }); |
|
38 | } |
|
39 | ||
40 | public function leaveNode(Twig_Node $node, Twig_Environment $env) |
|
41 | { |
|
42 | return $node; |
|
43 | } |
|
44 | ||
45 | public function getPriority() |
|
46 | { |
|
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |
@@ 21-49 (lines=29) @@ | ||
18 | /** |
|
19 | * @author Tobias Nyholm <[email protected]> |
|
20 | */ |
|
21 | final class Twig2TranslationFilter extends BaseVisitor implements \Twig_NodeVisitorInterface |
|
22 | { |
|
23 | /** |
|
24 | * @var WorkerTranslationFilter |
|
25 | */ |
|
26 | private $worker; |
|
27 | ||
28 | public function __construct() |
|
29 | { |
|
30 | $this->worker = new WorkerTranslationFilter(); |
|
31 | } |
|
32 | ||
33 | public function enterNode(Twig_Node $node, Twig_Environment $env) |
|
34 | { |
|
35 | return $this->worker->work($node, $this->collection, function () { |
|
36 | return $this->getAbsoluteFilePath(); |
|
37 | }); |
|
38 | } |
|
39 | ||
40 | public function leaveNode(Twig_Node $node, Twig_Environment $env) |
|
41 | { |
|
42 | return $node; |
|
43 | } |
|
44 | ||
45 | public function getPriority() |
|
46 | { |
|
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |