@@ -52,7 +52,7 @@ |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | // neither explicit timezone nor variable present, so use nothing |
55 | - $this->timezoneString= null; |
|
55 | + $this->timezoneString = null; |
|
56 | 56 | $this->timezoneVariable = null; |
57 | 57 | } |
58 | 58 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $this->instantiator->checkCommand($cmd); |
42 | 42 | |
43 | - if($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
43 | + if ($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
44 | 44 | { |
45 | 45 | return $cmd; |
46 | 46 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | throw $this->instantiator->exceptionUnexpectedType('ShowVariable', $cmd); |
49 | 49 | } |
50 | 50 | |
51 | - public function date(string $variableName, string $formatString="", string $timezoneString="") : Mailcode_Commands_Command_ShowDate |
|
51 | + public function date(string $variableName, string $formatString = "", string $timezoneString = "") : Mailcode_Commands_Command_ShowDate |
|
52 | 52 | { |
53 | 53 | return (new Date())->create($variableName, $formatString, $timezoneString); |
54 | 54 | } |
55 | 55 | |
56 | - public function number(string $variableName, string $formatString="", bool $absolute=false) : Mailcode_Commands_Command_ShowNumber |
|
56 | + public function number(string $variableName, string $formatString = "", bool $absolute = false) : Mailcode_Commands_Command_ShowNumber |
|
57 | 57 | { |
58 | 58 | return (new Number())->create($variableName, $formatString, $absolute); |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return Mailcode_Commands_Command_ShowPhone |
68 | 68 | * @throws Mailcode_Factory_Exception |
69 | 69 | */ |
70 | - public function phone(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
70 | + public function phone(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
71 | 71 | { |
72 | 72 | return (new Phone())->create($variableName, $sourceFormat, $urlEncoding); |
73 | 73 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return Mailcode_Commands_Command_ShowURL |
90 | 90 | * @throws Mailcode_Factory_Exception |
91 | 91 | */ |
92 | - public function url(string $url, ?string $trackingID=null, array $queryParams=array()) : Mailcode_Commands_Command_ShowURL |
|
92 | + public function url(string $url, ?string $trackingID = null, array $queryParams = array()) : Mailcode_Commands_Command_ShowURL |
|
93 | 93 | { |
94 | 94 | return (new URL())->create($url, $trackingID, $queryParams); |
95 | 95 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class Date extends Mailcode_Factory_CommandSets_Set |
25 | 25 | { |
26 | - public function create(string $variableName, string $formatString="", string $timezoneString="") : Mailcode_Commands_Command_ShowDate |
|
26 | + public function create(string $variableName, string $formatString = "", string $timezoneString = "") : Mailcode_Commands_Command_ShowDate |
|
27 | 27 | { |
28 | 28 | $variableName = $this->instantiator->filterVariableName($variableName); |
29 | 29 | |
30 | 30 | $format = ''; |
31 | - if(!empty($formatString)) |
|
31 | + if (!empty($formatString)) |
|
32 | 32 | { |
33 | 33 | $format = sprintf( |
34 | 34 | ' "%s"', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | $timezone = ''; |
40 | - if(!empty($timezoneString)) |
|
40 | + if (!empty($timezoneString)) |
|
41 | 41 | { |
42 | 42 | $timezone = sprintf( |
43 | 43 | ' %s', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->instantiator->checkCommand($cmd); |
61 | 61 | |
62 | - if($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
62 | + if ($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
63 | 63 | { |
64 | 64 | return $cmd; |
65 | 65 | } |
@@ -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 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | if (!empty($command->getTimezoneString())) { |
72 | 72 | $timezoneFormat = sprintf('.zone("%s")', $command->getTimezoneString()); |
73 | - } else if(!empty($command->getTimezoneVariable())) { |
|
73 | + } else if (!empty($command->getTimezoneVariable())) { |
|
74 | 74 | $timezoneFormat = sprintf('.zone(%s)', $command->getTimezoneVariable()); |
75 | 75 | } |
76 | 76 |