@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | if (!$token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) { |
40 | 40 | $this->validationResult->makeError( |
41 | - t('Invalid namespace token:') . ' ' . t('Expected a string.'), |
|
41 | + t('Invalid namespace token:').' '.t('Expected a string.'), |
|
42 | 42 | NamespaceInterface::VALIDATION_NAMESPACE_WRONG_TYPE |
43 | 43 | ); |
44 | 44 | return; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $token = $this->getNamespaceToken(); |
63 | 63 | |
64 | - if($token !== null) { |
|
64 | + if ($token !== null) { |
|
65 | 65 | return $token; |
66 | 66 | } |
67 | 67 |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | |
32 | 32 | private string $paramsString; |
33 | 33 | |
34 | - /** |
|
35 | - * @var string[] |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string[] |
|
36 | + */ |
|
37 | 37 | private array $names = array( |
38 | 38 | 'and', |
39 | 39 | 'or' |
40 | 40 | ); |
41 | 41 | |
42 | - /** |
|
43 | - * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var Mailcode_Commands_LogicKeywords_Keyword[] |
|
44 | + */ |
|
45 | 45 | private array $keywords = array(); |
46 | 46 | |
47 | 47 | private string $mainParams = ''; |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - /** |
|
132 | - * @return string[] |
|
133 | - */ |
|
131 | + /** |
|
132 | + * @return string[] |
|
133 | + */ |
|
134 | 134 | private function detectParameters() : array |
135 | 135 | { |
136 | 136 | $params = $this->paramsString; |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | return $stack; |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * @param string $params |
|
153 | - * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
154 | - * @param string[] $stack |
|
155 | - * @throws Mailcode_Exception |
|
156 | - * @return string |
|
157 | - */ |
|
151 | + /** |
|
152 | + * @param string $params |
|
153 | + * @param Mailcode_Commands_LogicKeywords_Keyword $keyword |
|
154 | + * @param string[] $stack |
|
155 | + * @throws Mailcode_Exception |
|
156 | + * @return string |
|
157 | + */ |
|
158 | 158 | private function detectParamsKeyword(string $params, Mailcode_Commands_LogicKeywords_Keyword $keyword, array &$stack) : string |
159 | 159 | { |
160 | 160 | $search = $keyword->getMatchedString(); |
@@ -189,22 +189,22 @@ discard block |
||
189 | 189 | return $params; |
190 | 190 | } |
191 | 191 | |
192 | - /** |
|
193 | - * Extracts the parameters string to use for the |
|
194 | - * original command itself, omitting all the logic |
|
195 | - * keywords for the sub-commands. |
|
196 | - * |
|
197 | - * @return string |
|
198 | - */ |
|
192 | + /** |
|
193 | + * Extracts the parameters string to use for the |
|
194 | + * original command itself, omitting all the logic |
|
195 | + * keywords for the sub-commands. |
|
196 | + * |
|
197 | + * @return string |
|
198 | + */ |
|
199 | 199 | public function getMainParamsString() : string |
200 | 200 | { |
201 | 201 | return $this->mainParams; |
202 | 202 | } |
203 | 203 | |
204 | - /** |
|
205 | - * Retrieves the detected keyword names. |
|
206 | - * @return string[] |
|
207 | - */ |
|
204 | + /** |
|
205 | + * Retrieves the detected keyword names. |
|
206 | + * @return string[] |
|
207 | + */ |
|
208 | 208 | public function getDetectedNames() : array |
209 | 209 | { |
210 | 210 | $names = array(); |
@@ -221,23 +221,23 @@ discard block |
||
221 | 221 | return $names; |
222 | 222 | } |
223 | 223 | |
224 | - /** |
|
225 | - * Retrieves all keywords detected in the |
|
226 | - * command's parameter string, if any. |
|
227 | - * |
|
228 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
229 | - */ |
|
224 | + /** |
|
225 | + * Retrieves all keywords detected in the |
|
226 | + * command's parameter string, if any. |
|
227 | + * |
|
228 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
229 | + */ |
|
230 | 230 | public function getKeywords() : array |
231 | 231 | { |
232 | 232 | return $this->keywords; |
233 | 233 | } |
234 | 234 | |
235 | - /** |
|
236 | - * Detects any keyword statements in the parameters by keyword name. |
|
237 | - * |
|
238 | - * @param string $name |
|
239 | - * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
240 | - */ |
|
235 | + /** |
|
236 | + * Detects any keyword statements in the parameters by keyword name. |
|
237 | + * |
|
238 | + * @param string $name |
|
239 | + * @return Mailcode_Commands_LogicKeywords_Keyword[] |
|
240 | + */ |
|
241 | 241 | private function detectKeywords(string $name) : array |
242 | 242 | { |
243 | 243 | $regex = sprintf('/%1$s\s+([a-z\-0-9]+):|%1$s:/x', $name); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | |
64 | 64 | private function parse() : void |
65 | 65 | { |
66 | - foreach($this->names as $name) |
|
66 | + foreach ($this->names as $name) |
|
67 | 67 | { |
68 | - if(stripos($this->paramsString, $name) === false) { |
|
68 | + if (stripos($this->paramsString, $name) === false) { |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $names = $this->getDetectedNames(); |
82 | 82 | $amount = count($names); |
83 | 83 | |
84 | - if($amount > 1) |
|
84 | + if ($amount > 1) |
|
85 | 85 | { |
86 | 86 | $this->makeError( |
87 | 87 | t( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | private function splitParams() : void |
103 | 103 | { |
104 | - if(empty($this->keywords)) |
|
104 | + if (empty($this->keywords)) |
|
105 | 105 | { |
106 | 106 | $this->mainParams = $this->paramsString; |
107 | 107 | |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | |
111 | 111 | $params = $this->detectParameters(); |
112 | 112 | |
113 | - foreach($this->keywords as $keyword) |
|
113 | + foreach ($this->keywords as $keyword) |
|
114 | 114 | { |
115 | 115 | $kParams = (string)array_shift($params); |
116 | 116 | |
117 | 117 | $keyword->setParamsString($kParams); |
118 | 118 | |
119 | - if(!$keyword->isValid()) |
|
119 | + if (!$keyword->isValid()) |
|
120 | 120 | { |
121 | 121 | $this->makeError( |
122 | 122 | t('Error #%1$s:', $keyword->getCode()).' '.$keyword->getErrorMessage(), |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $params = $this->paramsString; |
137 | 137 | $stack = array(); |
138 | 138 | |
139 | - foreach($this->keywords as $keyword) |
|
139 | + foreach ($this->keywords as $keyword) |
|
140 | 140 | { |
141 | 141 | $params = $this->detectParamsKeyword($params, $keyword, $stack); |
142 | 142 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $search = $keyword->getMatchedString(); |
161 | 161 | $pos = strpos($params, $search, 0); |
162 | 162 | |
163 | - if($pos === false) |
|
163 | + if ($pos === false) |
|
164 | 164 | { |
165 | 165 | throw new Mailcode_Exception( |
166 | 166 | 'Keyword matched string not found', |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $store = substr($params, 0, $pos); |
175 | 175 | |
176 | - if($store === false) |
|
176 | + if ($store === false) |
|
177 | 177 | { |
178 | 178 | throw new Mailcode_Exception( |
179 | 179 | 'Keyword substring not found', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
185 | - $params = trim(substr($params, $pos+$length)); |
|
185 | + $params = trim(substr($params, $pos + $length)); |
|
186 | 186 | |
187 | 187 | $stack[] = $store; |
188 | 188 | |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | { |
210 | 210 | $names = array(); |
211 | 211 | |
212 | - foreach($this->keywords as $keyword) |
|
212 | + foreach ($this->keywords as $keyword) |
|
213 | 213 | { |
214 | 214 | $name = $keyword->getName(); |
215 | 215 | |
216 | - if(!in_array($name, $names, true)) { |
|
216 | + if (!in_array($name, $names, true)) { |
|
217 | 217 | $names[] = $name; |
218 | 218 | } |
219 | 219 | } |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | $matches = array(); |
246 | 246 | preg_match_all($regex, $this->paramsString, $matches, PREG_PATTERN_ORDER); |
247 | 247 | |
248 | - if(empty($matches[0][0])) { |
|
248 | + if (empty($matches[0][0])) { |
|
249 | 249 | return array(); |
250 | 250 | } |
251 | 251 | |
252 | 252 | $amount = count($matches[0]); |
253 | 253 | $result = array(); |
254 | 254 | |
255 | - for($i=0; $i < $amount; $i++) |
|
255 | + for ($i = 0; $i < $amount; $i++) |
|
256 | 256 | { |
257 | 257 | $result[] = $this->createKeyword( |
258 | 258 | $name, |
@@ -269,22 +269,22 @@ discard block |
||
269 | 269 | return !empty($this->keywords); |
270 | 270 | } |
271 | 271 | |
272 | - public function appendAND(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
272 | + public function appendAND(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
273 | 273 | { |
274 | 274 | return $this->appendKeyword('and', $paramsString, $type); |
275 | 275 | } |
276 | 276 | |
277 | - public function appendOR(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
277 | + public function appendOR(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
278 | 278 | { |
279 | 279 | return $this->appendKeyword('or', $paramsString, $type); |
280 | 280 | } |
281 | 281 | |
282 | - public function appendKeyword(string $name, string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword |
|
282 | + public function appendKeyword(string $name, string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
283 | 283 | { |
284 | 284 | $keyword = $this->createKeyword($name, $type); |
285 | 285 | $keyword->setParamsString($paramsString); |
286 | 286 | |
287 | - if(!$keyword->isValid()) |
|
287 | + if (!$keyword->isValid()) |
|
288 | 288 | { |
289 | 289 | throw new Mailcode_Exception( |
290 | 290 | 'Cannot append invalid logic keyword', |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | return $keyword; |
306 | 306 | } |
307 | 307 | |
308 | - private function createKeyword(string $name, string $type='', string $matchedString='') : Mailcode_Commands_LogicKeywords_Keyword |
|
308 | + private function createKeyword(string $name, string $type = '', string $matchedString = '') : Mailcode_Commands_LogicKeywords_Keyword |
|
309 | 309 | { |
310 | - if(empty($matchedString)) |
|
310 | + if (empty($matchedString)) |
|
311 | 311 | { |
312 | 312 | $matchedString = $name; |
313 | 313 | |
314 | - if(!empty($type)) |
|
314 | + if (!empty($type)) |
|
315 | 315 | { |
316 | 316 | $matchedString .= ' '.$type; |
317 | 317 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $command->getID() |
45 | 45 | ); |
46 | 46 | |
47 | - if(!class_exists($class)) |
|
47 | + if (!class_exists($class)) |
|
48 | 48 | { |
49 | 49 | throw new Mailcode_Translator_Exception( |
50 | 50 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $translator = new $class($this); |
60 | 60 | |
61 | - if($translator instanceof BaseCommandTranslation) |
|
61 | + if ($translator instanceof BaseCommandTranslation) |
|
62 | 62 | { |
63 | 63 | return $translator; |
64 | 64 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $subject = $safeguard->makeSafe(); |
84 | 84 | |
85 | - if(!$safeguard->hasPlaceholders()) |
|
85 | + if (!$safeguard->hasPlaceholders()) |
|
86 | 86 | { |
87 | 87 | return $subject; |
88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $replaces = array(); |
93 | 93 | |
94 | - foreach($placeholders as $placeholder) |
|
94 | + foreach ($placeholders as $placeholder) |
|
95 | 95 | { |
96 | 96 | $command = $placeholder->getCommand(); |
97 | 97 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // All other special characters have to be escaped |
81 | 81 | // with two backslashes. |
82 | 82 | foreach ($this->regexSpecialChars as $char) { |
83 | - $string = str_replace($char, '\\' . $char, $string); |
|
83 | + $string = str_replace($char, '\\'.$char, $string); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Restore the escaped quotes, which stay escaped |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | if ($currencyToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) { |
142 | 142 | $displayedCurrency = $currencyToken->getNormalized(); |
143 | 143 | } else if ($currencyToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) { |
144 | - $displayedCurrency = '"' . $currencyToken->getText() . '"'; |
|
144 | + $displayedCurrency = '"'.$currencyToken->getText().'"'; |
|
145 | 145 | } else if ($withCurrencyName) { |
146 | - $displayedCurrency = '"' . $localCurrency->getCurrencyName() . '"'; |
|
146 | + $displayedCurrency = '"'.$localCurrency->getCurrencyName().'"'; |
|
147 | 147 | } else { |
148 | - $displayedCurrency = '"' . $localCurrency->getCurrencySymbol() . '"'; |
|
148 | + $displayedCurrency = '"'.$localCurrency->getCurrencySymbol().'"'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $regionToken = $localCurrency->getRegion(); |
152 | 152 | if ($regionToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) { |
153 | 153 | $displayedCountry = $regionToken->getNormalized(); |
154 | 154 | } else if ($regionToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) { |
155 | - $displayedCountry = '"' . $regionToken->getText() . '"'; |
|
155 | + $displayedCountry = '"'.$regionToken->getText().'"'; |
|
156 | 156 | } else { |
157 | - $displayedCountry = '"' . $localCurrency->getCountry() . '"'; |
|
157 | + $displayedCountry = '"'.$localCurrency->getCountry().'"'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return sprintf( |
@@ -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 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return class-string[] |
28 | 28 | * @throws FileHelper_Exception |
29 | 29 | */ |
30 | - public static function findClassesInFolder($folder, bool $recursive=false, ?string $instanceOf=null) : array |
|
30 | + public static function findClassesInFolder($folder, bool $recursive = false, ?string $instanceOf = null) : array |
|
31 | 31 | { |
32 | 32 | return self::createCache() |
33 | 33 | ->findClassesInFolder( |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | private static function createCache() : ClassRepositoryManager |
44 | 44 | { |
45 | - if(!isset(self::$cache)) { |
|
45 | + if (!isset(self::$cache)) { |
|
46 | 46 | self::$cache = ClassRepositoryManager::create(Mailcode::getCacheFolder()); |
47 | 47 | } |
48 | 48 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public static function create() : Mailcode_Translator |
35 | 35 | { |
36 | - if(is_null(self::$instance)) { |
|
36 | + if (is_null(self::$instance)) { |
|
37 | 37 | self::$instance = new self(); |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() |
44 | 44 | { |
45 | - foreach($this->resolveSyntaxClasses() as $class) { |
|
45 | + foreach ($this->resolveSyntaxClasses() as $class) { |
|
46 | 46 | $syntax = new $class(); |
47 | 47 | $this->syntaxes[$syntax->getTypeID()] = $syntax; |
48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function createSyntax(string $name) : SyntaxInterface |
58 | 58 | { |
59 | - if(isset($this->syntaxes[$name])) { |
|
59 | + if (isset($this->syntaxes[$name])) { |
|
60 | 60 | return $this->syntaxes[$name]; |
61 | 61 | } |
62 | 62 |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | - /** |
|
63 | - * Creates a new mailcode instance. |
|
64 | - * @return Mailcode |
|
65 | - */ |
|
62 | + /** |
|
63 | + * Creates a new mailcode instance. |
|
64 | + * @return Mailcode |
|
65 | + */ |
|
66 | 66 | public static function create() : Mailcode |
67 | 67 | { |
68 | 68 | return new Mailcode(); |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Parses the string to detect all commands contained within. |
|
78 | - * |
|
79 | - * @param string $string |
|
80 | - * @return Mailcode_Collection |
|
81 | - */ |
|
77 | + * Parses the string to detect all commands contained within. |
|
78 | + * |
|
79 | + * @param string $string |
|
80 | + * @return Mailcode_Collection |
|
81 | + */ |
|
82 | 82 | public function parseString(string $string) : Mailcode_Collection |
83 | 83 | { |
84 | 84 | return $this->getParser() |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | ->getCollection(); |
87 | 87 | } |
88 | 88 | |
89 | - /** |
|
90 | - * Retrieves the string parser instance used to detect commands. |
|
91 | - * |
|
92 | - * @return Mailcode_Parser |
|
93 | - */ |
|
89 | + /** |
|
90 | + * Retrieves the string parser instance used to detect commands. |
|
91 | + * |
|
92 | + * @return Mailcode_Parser |
|
93 | + */ |
|
94 | 94 | public function getParser() : Mailcode_Parser |
95 | 95 | { |
96 | 96 | if(!isset($this->parser)) |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | return $this->parser; |
102 | 102 | } |
103 | 103 | |
104 | - /** |
|
105 | - * Retrieves the commands collection, which is used to |
|
106 | - * access information on the available commands. |
|
107 | - * |
|
108 | - * @return Mailcode_Commands |
|
109 | - */ |
|
104 | + /** |
|
105 | + * Retrieves the commands collection, which is used to |
|
106 | + * access information on the available commands. |
|
107 | + * |
|
108 | + * @return Mailcode_Commands |
|
109 | + */ |
|
110 | 110 | public function getCommands() : Mailcode_Commands |
111 | 111 | { |
112 | 112 | if(!isset($this->commands)) |
@@ -149,23 +149,23 @@ discard block |
||
149 | 149 | return $this->variables; |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Creates the translator, which can be used to convert commands |
|
154 | - * to another supported syntax. |
|
155 | - * |
|
156 | - * @return Mailcode_Translator |
|
157 | - */ |
|
152 | + /** |
|
153 | + * Creates the translator, which can be used to convert commands |
|
154 | + * to another supported syntax. |
|
155 | + * |
|
156 | + * @return Mailcode_Translator |
|
157 | + */ |
|
158 | 158 | public function createTranslator() : Mailcode_Translator |
159 | 159 | { |
160 | 160 | return Mailcode_Translator::create(); |
161 | 161 | } |
162 | 162 | |
163 | - /** |
|
164 | - * Creates the styler, which can be used to retrieve the |
|
165 | - * CSS required to style the highlighted commands in HTML. |
|
166 | - * |
|
167 | - * @return Mailcode_Styler |
|
168 | - */ |
|
163 | + /** |
|
164 | + * Creates the styler, which can be used to retrieve the |
|
165 | + * CSS required to style the highlighted commands in HTML. |
|
166 | + * |
|
167 | + * @return Mailcode_Styler |
|
168 | + */ |
|
169 | 169 | public function createStyler() : Mailcode_Styler |
170 | 170 | { |
171 | 171 | return new Mailcode_Styler(); |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | public static function getCacheFolder() : FolderInfo |
48 | 48 | { |
49 | - if(isset(self::$cacheFolder)) { |
|
49 | + if (isset(self::$cacheFolder)) { |
|
50 | 50 | return self::$cacheFolder; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $folder = ClassHelper::getCacheFolder(); |
54 | - if($folder !== null) { |
|
54 | + if ($folder !== null) { |
|
55 | 55 | return $folder; |
56 | 56 | } |
57 | 57 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getParser() : Mailcode_Parser |
101 | 101 | { |
102 | - if(!isset($this->parser)) |
|
102 | + if (!isset($this->parser)) |
|
103 | 103 | { |
104 | 104 | $this->parser = new Mailcode_Parser($this); |
105 | 105 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getCommands() : Mailcode_Commands |
117 | 117 | { |
118 | - if(!isset($this->commands)) |
|
118 | + if (!isset($this->commands)) |
|
119 | 119 | { |
120 | 120 | $this->commands = new Mailcode_Commands(); |
121 | 121 | } |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | * @param Mailcode_Commands_Command|null $sourceCommand |
141 | 141 | * @return Mailcode_Variables_Collection_Regular |
142 | 142 | */ |
143 | - public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Variables_Collection_Regular |
|
143 | + public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Variables_Collection_Regular |
|
144 | 144 | { |
145 | 145 | return $this->createVariables()->parseString($subject, $sourceCommand); |
146 | 146 | } |
147 | 147 | |
148 | 148 | public function createVariables() : Mailcode_Variables |
149 | 149 | { |
150 | - if(!isset($this->variables)) |
|
150 | + if (!isset($this->variables)) |
|
151 | 151 | { |
152 | 152 | $this->variables = new Mailcode_Variables(); |
153 | 153 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return self::$logger; |
207 | 207 | } |
208 | 208 | |
209 | - public static function setDebugging(bool $enabled=true) : void |
|
209 | + public static function setDebugging(bool $enabled = true) : void |
|
210 | 210 | { |
211 | 211 | self::$debug = $enabled; |
212 | 212 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | * @param array<string|int,mixed> $context |
222 | 222 | * @return void |
223 | 223 | */ |
224 | - public static function debug(string $message, array $context=array()) : void |
|
224 | + public static function debug(string $message, array $context = array()) : void |
|
225 | 225 | { |
226 | - if(self::$debug && isset(self::$logger)) |
|
226 | + if (self::$debug && isset(self::$logger)) |
|
227 | 227 | { |
228 | 228 | self::$logger->debug($message, $context); |
229 | 229 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | declare(strict_types=1); |
14 | 14 | |
15 | -use AppUtils\ConvertHelper\JSONConverter;use AppUtils\CSVHelper; |
|
16 | -use AppUtils\CSVHelper_Exception;use AppUtils\FileHelper; |
|
17 | -use AppUtils\FileHelper_Exception;use libphonenumber\PhoneNumberFormat; |
|
18 | -use libphonenumber\PhoneNumberUtil;use Mailcode\Mailcode;use function AppLocalize\pts; |
|
15 | +use AppUtils\ConvertHelper\JSONConverter; use AppUtils\CSVHelper; |
|
16 | +use AppUtils\CSVHelper_Exception; use AppUtils\FileHelper; |
|
17 | +use AppUtils\FileHelper_Exception; use libphonenumber\PhoneNumberFormat; |
|
18 | +use libphonenumber\PhoneNumberUtil; use Mailcode\Mailcode; use function AppLocalize\pts; |
|
19 | 19 | |
20 | 20 | require_once 'prepend.php'; |
21 | 21 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | |
95 | 95 | $meta = $phoneNumberUtil->getMetadataForRegion($code); |
96 | 96 | if (!$meta) { |
97 | - die('No metadata for ' . $code); |
|
97 | + die('No metadata for '.$code); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $exampleNumber = $phoneNumberUtil->getExampleNumber($code); |
101 | 101 | |
102 | 102 | // PHPStan complains about this, but the method can return null - it's not documented correctly. |
103 | - if($exampleNumber === null) { |
|
104 | - die('No example number for ' . $code); |
|
103 | + if ($exampleNumber === null) { |
|
104 | + die('No example number for '.$code); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $local = $phoneNumberUtil->formatInOriginalFormat($exampleNumber, $code); |