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