Total Complexity | 11 |
Total Lines | 75 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class Mailcode_Translator_Syntax_ApacheVelocity extends Mailcode_Translator_Syntax |
||
22 | { |
||
23 | protected function _translateElseIf(Mailcode_Commands_Command_ElseIf $command): string |
||
24 | { |
||
25 | $params = $command->getParams(); |
||
26 | |||
27 | if($params) |
||
|
|||
28 | { |
||
29 | return sprintf( |
||
30 | '#elseif(%s)', |
||
31 | $params->getNormalized() |
||
32 | ); |
||
33 | } |
||
34 | |||
35 | return ''; |
||
36 | } |
||
37 | |||
38 | protected function _translateElse(Mailcode_Commands_Command_Else $command): string |
||
39 | { |
||
40 | return '#{else}'; |
||
41 | } |
||
42 | |||
43 | protected function _translateIf(Mailcode_Commands_Command_If $command): string |
||
44 | { |
||
45 | $params = $command->getParams(); |
||
46 | |||
47 | if($params) |
||
48 | { |
||
49 | return sprintf( |
||
50 | '#if(%s)', |
||
51 | $params->getNormalized() |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | return ''; |
||
56 | } |
||
57 | |||
58 | protected function _translateShowVariable(Mailcode_Commands_Command_ShowVariable $command): string |
||
59 | { |
||
60 | return '${'.ltrim($command->getVariableName(), '$').'}'; |
||
61 | } |
||
62 | |||
63 | protected function _translateFor(Mailcode_Commands_Command_For $command): string |
||
76 | } |
||
77 | |||
78 | protected function _translateSetVariable(Mailcode_Commands_Command_SetVariable $command): string |
||
79 | { |
||
80 | $params = $command->getParams(); |
||
81 | |||
82 | if($params) |
||
83 | { |
||
84 | return sprintf( |
||
85 | '#set(%s)', |
||
86 | $params->getNormalized() |
||
87 | ); |
||
88 | } |
||
89 | |||
90 | return ''; |
||
91 | } |
||
92 | |||
93 | protected function _translateEnd(Mailcode_Commands_Command_End $command): string |
||
96 | } |
||
97 | } |
||
98 |