@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | abstract class Mailcode_Translator_Syntax_ApacheVelocity extends Mailcode_Translator_Command |
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | - * @var string[] |
|
| 28 | - */ |
|
| 27 | + * @var string[] |
|
| 28 | + */ |
|
| 29 | 29 | private array $regexSpecialChars = array( |
| 30 | 30 | '?', |
| 31 | 31 | '.', |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Filters the string for use in an Apache Velocity (Java) |
|
| 54 | - * regex string: escapes all special characters. |
|
| 55 | - * |
|
| 56 | - * Velocity does its own escaping, so no need to escape special |
|
| 57 | - * characters as if they were a javascript string. |
|
| 58 | - * |
|
| 59 | - * @param string $string |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 53 | + * Filters the string for use in an Apache Velocity (Java) |
|
| 54 | + * regex string: escapes all special characters. |
|
| 55 | + * |
|
| 56 | + * Velocity does its own escaping, so no need to escape special |
|
| 57 | + * characters as if they were a javascript string. |
|
| 58 | + * |
|
| 59 | + * @param string $string |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | 62 | public function filterRegexString(string $string) : string |
| 63 | 63 | { |
| 64 | 64 | // Special case: previously escaped quotes. |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // All other special characters have to be escaped |
| 74 | 74 | // with two backslashes. |
| 75 | - foreach($this->regexSpecialChars as $char) |
|
| 75 | + foreach ($this->regexSpecialChars as $char) |
|
| 76 | 76 | { |
| 77 | 77 | $string = str_replace($char, '\\'.$char, $string); |
| 78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | protected function renderVariableEncodings(Mailcode_Commands_Command $command, string $varName) : string |
| 88 | 88 | { |
| 89 | - if(!$command instanceof EncodableInterface || !$command->hasActiveEncodings()) |
|
| 89 | + if (!$command instanceof EncodableInterface || !$command->hasActiveEncodings()) |
|
| 90 | 90 | { |
| 91 | 91 | return sprintf( |
| 92 | 92 | '${%s}', |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $varName = '$'.ltrim($varName, '$'); |
| 103 | 103 | |
| 104 | - if($absolute) |
|
| 104 | + if ($absolute) |
|
| 105 | 105 | { |
| 106 | 106 | $varName = sprintf('${numeric.abs(%s)}', $varName); |
| 107 | 107 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $encodings = $command->getActiveEncodings(); |
| 154 | 154 | $result = $statement; |
| 155 | 155 | |
| 156 | - foreach($encodings as $encoding) |
|
| 156 | + foreach ($encodings as $encoding) |
|
| 157 | 157 | { |
| 158 | 158 | $result = $this->renderEncoding($encoding, $result); |
| 159 | 159 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | 'ShowVariable', |
| 36 | 36 | '', |
| 37 | 37 | $variableName, |
| 38 | - '{showvar:' . $variableName . '}' |
|
| 38 | + '{showvar:'.$variableName.'}' |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | $this->instantiator->checkCommand($cmd); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $cmd = $this->commands->createCommand( |
| 52 | 52 | 'ShowDate', |
| 53 | 53 | '', |
| 54 | - $variableName . $format . $timezone, |
|
| 54 | + $variableName.$format.$timezone, |
|
| 55 | 55 | sprintf( |
| 56 | 56 | '{showdate: %s%s%s}', |
| 57 | 57 | $variableName, |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return $string; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - return '"' . str_replace('"', '\"', $string) . '"'; |
|
| 78 | + return '"'.str_replace('"', '\"', $string).'"'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | public function __construct(string $message, ?string $details = null, $code = null, $previous = null) |
| 24 | 24 | { |
| 25 | - if(defined('TESTS_ROOT') && !empty($details)) { |
|
| 25 | + if (defined('TESTS_ROOT') && !empty($details)) { |
|
| 26 | 26 | $message .= PHP_EOL. |
| 27 | 27 | 'Details:'.PHP_EOL. |
| 28 | 28 | $details; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | if (!$this->timezoneToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral && |
| 41 | 41 | !$this->timezoneToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) { |
| 42 | 42 | $this->validationResult->makeError( |
| 43 | - t('Invalid timezone type.' . ' ' . 'Expected String or Variable.'), |
|
| 43 | + t('Invalid timezone type.'.' '.'Expected String or Variable.'), |
|
| 44 | 44 | TimezoneInterface::VALIDATION_TIMEZONE_CODE_WRONG_TYPE |
| 45 | 45 | ); |
| 46 | 46 | return; |