Total Complexity | 6 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class Mailcode_Translator_Syntax_ApacheVelocity_SetVariable extends Mailcode_Translator_Syntax_ApacheVelocity implements Mailcode_Translator_Command_SetVariable |
||
22 | { |
||
23 | public function translate(Mailcode_Commands_Command_SetVariable $command): string |
||
24 | { |
||
25 | $assignmentString = $command->getAssignmentString(); |
||
26 | |||
27 | if ($command->isCountEnabled()) |
||
28 | { |
||
29 | $result = $this->buildCountAssignment($command); |
||
30 | if($result !== null) { |
||
31 | $assignmentString = $result; |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return sprintf( |
||
36 | '#set(%s = %s)', |
||
37 | $command->getVariable()->getFullName(), |
||
38 | $assignmentString |
||
39 | ); |
||
40 | } |
||
41 | |||
42 | private function buildCountAssignment(Mailcode_Commands_Command_SetVariable $command) : ?string |
||
61 | ); |
||
62 | } |
||
64 |