@@ -48,16 +48,16 @@ |
||
| 48 | 48 | $statements = array(); |
| 49 | 49 | $statements[] = $this->renderURL($urlVar); |
| 50 | 50 | |
| 51 | - if($command->isTrackingEnabled()) |
|
| 51 | + if ($command->isTrackingEnabled()) |
|
| 52 | 52 | { |
| 53 | 53 | $statements[] = $this->renderTracking($command); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if($command->hasQueryParams()) |
|
| 56 | + if ($command->hasQueryParams()) |
|
| 57 | 57 | { |
| 58 | 58 | $params = $command->getQueryParams(); |
| 59 | 59 | |
| 60 | - foreach($params as $name => $value) |
|
| 60 | + foreach ($params as $name => $value) |
|
| 61 | 61 | { |
| 62 | 62 | $statements[] = $this->renderQueryParam($name, $value); |
| 63 | 63 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | if ($command->isCountEnabled()) |
| 28 | 28 | { |
| 29 | 29 | $result = $this->buildCountAssignment($command); |
| 30 | - if($result !== null) { |
|
| 30 | + if ($result !== null) { |
|
| 31 | 31 | $assignmentString = $result; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if($variable->hasPath()) { |
|
| 50 | + if ($variable->hasPath()) { |
|
| 51 | 51 | return sprintf( |
| 52 | 52 | '$map.of(%s).keys("%s").count()', |
| 53 | 53 | dollarize($variable->getPath()), |
@@ -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 | |