@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function translate(Mailcode_Commands_Command_ShowVariable $command): string |
24 | 24 | { |
25 | - if($command->isDecryptionEnabled()) |
|
25 | + if ($command->isDecryptionEnabled()) |
|
26 | 26 | { |
27 | 27 | $varName = $this->renderDecryptionKey($command); |
28 | 28 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $keyName = $command->getDecryptionKeyName(); |
40 | 40 | |
41 | - if(!empty($keyName)) |
|
41 | + if (!empty($keyName)) |
|
42 | 42 | { |
43 | 43 | $varName = sprintf( |
44 | 44 | 'text.decrypt(%s, "%s")', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | - if($this->hasVariableEncodings($command)) { |
|
59 | + if ($this->hasVariableEncodings($command)) { |
|
60 | 60 | $varName = '${'.$varName.'}'; |
61 | 61 | } |
62 | 62 |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | if($command->isDecryptionEnabled()) |
26 | 26 | { |
27 | 27 | $varName = $this->renderDecryptionKey($command); |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | $varName = undollarize($command->getVariableName()); |
32 | 31 | } |
@@ -45,8 +44,7 @@ discard block |
||
45 | 44 | dollarize($command->getVariableName()), |
46 | 45 | $keyName |
47 | 46 | ); |
48 | - } |
|
49 | - else |
|
47 | + } else |
|
50 | 48 | { |
51 | 49 | // This will make the decryption system use the system's |
52 | 50 | // default key name. |
@@ -31,15 +31,15 @@ |
||
31 | 31 | // This ending command is tied to a preprocessing command: Since |
32 | 32 | // we do not want to keep these, we return an empty string to strip |
33 | 33 | // it out. |
34 | - if($openCmd instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
34 | + if ($openCmd instanceof Mailcode_Interfaces_Commands_PreProcessing) { |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | |
38 | - if($openCmd instanceof Mailcode_Commands_Command_For) { |
|
38 | + if ($openCmd instanceof Mailcode_Commands_Command_For) { |
|
39 | 39 | return '{% endfor %}'; |
40 | 40 | } |
41 | 41 | |
42 | - if($openCmd instanceof Mailcode_Commands_IfBase) { |
|
42 | + if ($openCmd instanceof Mailcode_Commands_IfBase) { |
|
43 | 43 | return '{% endif %}'; |
44 | 44 | } |
45 | 45 |
@@ -23,6 +23,6 @@ |
||
23 | 23 | { |
24 | 24 | public function translate(Mailcode_Commands_Command_ShowNumber $command): string |
25 | 25 | { |
26 | - return '{{ ' . $command->getVariableName() . ' }}'; |
|
26 | + return '{{ '.$command->getVariableName().' }}'; |
|
27 | 27 | } |
28 | 28 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | if ($command->isCountEnabled()) |
29 | 29 | { |
30 | 30 | $result = $this->buildCountAssignment($command); |
31 | - if($result !== null) { |
|
31 | + if ($result !== null) { |
|
32 | 32 | $assignmentString = $result; |
33 | 33 | } |
34 | 34 | } |
@@ -26,6 +26,6 @@ |
||
26 | 26 | { |
27 | 27 | public function translate(Mailcode_Commands_Command_ShowPhone $command): string |
28 | 28 | { |
29 | - return '{{ ' . $command->getVariableName() . ' }}'; |
|
29 | + return '{{ '.$command->getVariableName().' }}'; |
|
30 | 30 | } |
31 | 31 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $varName = undollarize($name); |
44 | 44 | |
45 | - if(self::areVariableNamesLowercase()) { |
|
45 | + if (self::areVariableNamesLowercase()) { |
|
46 | 46 | $varName = strtolower($varName); |
47 | 47 | } |
48 | 48 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $variables = Mailcode::create()->createVariables()->parseString($subject)->getAll(); |
55 | 55 | |
56 | - foreach($variables as $variable) { |
|
56 | + foreach ($variables as $variable) { |
|
57 | 57 | $subject = str_replace($variable->getMatchedText(), $this->formatVariableName($variable->getFullName()), $subject); |
58 | 58 | } |
59 | 59 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | public const ERROR_UNKNOWN_COMMAND_TYPE = 50401; |
30 | 30 | public const ERROR_INVALID_COMMAND_INSTANCE = 50402; |
31 | 31 | |
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | protected string $typeID; |
36 | 36 | |
37 | 37 | public function __construct(string $typeID) |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | $this->typeID = $typeID; |
40 | 40 | } |
41 | 41 | |
42 | - /** |
|
43 | - * Retrieves the syntax's type ID, e.g. "ApacheVelocity". |
|
44 | - * @return string |
|
45 | - */ |
|
42 | + /** |
|
43 | + * Retrieves the syntax's type ID, e.g. "ApacheVelocity". |
|
44 | + * @return string |
|
45 | + */ |
|
46 | 46 | public function getTypeID() : string |
47 | 47 | { |
48 | 48 | return $this->typeID; |
49 | 49 | } |
50 | 50 | |
51 | - /** |
|
52 | - * Translates a single command to the target syntax. |
|
53 | - * |
|
54 | - * @param Mailcode_Commands_Command $command |
|
55 | - * @throws Mailcode_Translator_Exception |
|
56 | - * @return string |
|
57 | - */ |
|
51 | + /** |
|
52 | + * Translates a single command to the target syntax. |
|
53 | + * |
|
54 | + * @param Mailcode_Commands_Command $command |
|
55 | + * @throws Mailcode_Translator_Exception |
|
56 | + * @return string |
|
57 | + */ |
|
58 | 58 | public function translateCommand(Mailcode_Commands_Command $command) : string |
59 | 59 | { |
60 | 60 | return $this->createTranslator($command)->translate($command); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | public function createTranslator(Mailcode_Commands_Command $command) : BaseCommandTranslation |
69 | 69 | { |
70 | 70 | $class = sprintf( |
71 | - __CLASS__ .'\%s\%sTranslation', |
|
71 | + __CLASS__.'\%s\%sTranslation', |
|
72 | 72 | $this->getTypeID(), |
73 | 73 | $command->getID() |
74 | 74 | ); |
75 | 75 | |
76 | - if(!class_exists($class)) |
|
76 | + if (!class_exists($class)) |
|
77 | 77 | { |
78 | 78 | throw new Mailcode_Translator_Exception( |
79 | 79 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $translator = new $class($command); |
89 | 89 | |
90 | - if($translator instanceof BaseCommandTranslation) |
|
90 | + if ($translator instanceof BaseCommandTranslation) |
|
91 | 91 | { |
92 | 92 | return $translator; |
93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $subject = $safeguard->makeSafe(); |
117 | 117 | |
118 | - if(!$safeguard->hasPlaceholders()) |
|
118 | + if (!$safeguard->hasPlaceholders()) |
|
119 | 119 | { |
120 | 120 | return $subject; |
121 | 121 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $replaces = array(); |
126 | 126 | |
127 | - foreach($placeholders as $placeholder) |
|
127 | + foreach ($placeholders as $placeholder) |
|
128 | 128 | { |
129 | 129 | $command = $placeholder->getCommand(); |
130 | 130 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param bool $enabled |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function setIDNDecoding(bool $enabled=true) : self |
|
36 | + public function setIDNDecoding(bool $enabled = true) : self |
|
37 | 37 | { |
38 | 38 | return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_IDN_DECODE, $enabled); |
39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param bool $enabled |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function setIDNEncoding(bool $enabled=true) : self |
|
36 | + public function setIDNEncoding(bool $enabled = true) : self |
|
37 | 37 | { |
38 | 38 | return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_IDN_ENCODE, $enabled); |
39 | 39 | } |