@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // IF type. |
46 | 46 | $method = 'translate'.$this->getIfType($command); |
47 | 47 | |
48 | - if(method_exists($this, $method)) |
|
48 | + if (method_exists($this, $method)) |
|
49 | 49 | { |
50 | 50 | return (string)$this->$method($command); |
51 | 51 | } |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $keywords = $command->getLogicKeywords()->getKeywords(); |
67 | 67 | |
68 | - foreach($keywords as $keyword) |
|
68 | + foreach ($keywords as $keyword) |
|
69 | 69 | { |
70 | 70 | $keyCommand = $keyword->getCommand(); |
71 | 71 | |
72 | - if($keyCommand instanceof Mailcode_Commands_IfBase) |
|
72 | + if ($keyCommand instanceof Mailcode_Commands_IfBase) |
|
73 | 73 | { |
74 | 74 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
75 | 75 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string |
99 | 99 | { |
100 | - switch($keyword->getName()) |
|
100 | + switch ($keyword->getName()) |
|
101 | 101 | { |
102 | 102 | case 'and': |
103 | 103 | return '&&'; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $sign = ''; |
132 | 132 | |
133 | - if($notEmpty) |
|
133 | + if ($notEmpty) |
|
134 | 134 | { |
135 | 135 | $sign = '!'; |
136 | 136 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | { |
147 | 147 | $params = $command->getParams(); |
148 | 148 | |
149 | - if(!$params) |
|
149 | + if (!$params) |
|
150 | 150 | { |
151 | 151 | return ''; |
152 | 152 | } |
153 | 153 | |
154 | - if($command->hasFreeformParameters()) |
|
154 | + if ($command->hasFreeformParameters()) |
|
155 | 155 | { |
156 | 156 | return $params->getStatementString(); |
157 | 157 | } |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | return $params->getNormalized(); |
160 | 160 | } |
161 | 161 | |
162 | - protected function _translateVariable(Mailcode_Variables_Variable $variable, string $comparator, string $value, bool $insensitive=false) : string |
|
162 | + protected function _translateVariable(Mailcode_Variables_Variable $variable, string $comparator, string $value, bool $insensitive = false) : string |
|
163 | 163 | { |
164 | 164 | $booleanCheck = strtolower(trim($value, '"')); |
165 | 165 | $fullName = $variable->getFullName(); |
166 | 166 | |
167 | - if(in_array($booleanCheck, array('true', 'false'))) |
|
167 | + if (in_array($booleanCheck, array('true', 'false'))) |
|
168 | 168 | { |
169 | 169 | $insensitive = true; |
170 | 170 | $value = '"'.$booleanCheck.'"'; |
171 | 171 | } |
172 | 172 | |
173 | - if($insensitive) |
|
173 | + if ($insensitive) |
|
174 | 174 | { |
175 | 175 | $fullName .= '.toLowerCase()'; |
176 | 176 | $value = mb_strtolower($value); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string |
203 | 203 | { |
204 | 204 | $method = $mode.'With'; |
205 | - if($caseSensitive) |
|
205 | + if ($caseSensitive) |
|
206 | 206 | { |
207 | 207 | $method = $mode.'WithIgnoreCase'; |
208 | 208 | } |
@@ -40,8 +40,7 @@ |
||
40 | 40 | if($keyCommand instanceof Mailcode_Commands_IfBase) |
41 | 41 | { |
42 | 42 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
43 | - } |
|
44 | - else |
|
43 | + } else |
|
45 | 44 | { |
46 | 45 | throw new Mailcode_Exception( |
47 | 46 | 'Keyword command type does not match expected base class.', |
@@ -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 |