@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $errors = $this->errors; |
101 | 101 | |
102 | - if(!$result->isValid()) |
|
102 | + if (!$result->isValid()) |
|
103 | 103 | { |
104 | 104 | $errors[] = new Mailcode_Collection_Error_Message( |
105 | 105 | '', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $errors = $this->getErrors(); |
117 | 117 | |
118 | - if(!empty($errors)) |
|
118 | + if (!empty($errors)) |
|
119 | 119 | { |
120 | 120 | return array_shift($errors); |
121 | 121 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | { |
158 | 158 | $hashes = array(); |
159 | 159 | |
160 | - foreach($this->commands as $command) |
|
160 | + foreach ($this->commands as $command) |
|
161 | 161 | { |
162 | 162 | $hash = $command->getHash(); |
163 | 163 | |
164 | - if(!isset($hashes[$hash])) |
|
164 | + if (!isset($hashes[$hash])) |
|
165 | 165 | { |
166 | 166 | $hashes[$hash] = $command; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | - foreach($commands as $command) |
|
181 | + foreach ($commands as $command) |
|
182 | 182 | { |
183 | 183 | $this->addCommand($command); |
184 | 184 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $collection = new Mailcode_Variables_Collection_Regular(); |
199 | 199 | |
200 | - foreach($this->commands as $command) |
|
200 | + foreach ($this->commands as $command) |
|
201 | 201 | { |
202 | 202 | $collection->mergeWith($command->getVariables()); |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function getValidationResult() : OperationResult |
209 | 209 | { |
210 | - if($this->validationResult instanceof OperationResult) |
|
210 | + if ($this->validationResult instanceof OperationResult) |
|
211 | 211 | { |
212 | 212 | return $this->validationResult; |
213 | 213 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | { |
224 | 224 | $errors = $this->getErrors(); |
225 | 225 | |
226 | - foreach($errors as $error) |
|
226 | + foreach ($errors as $error) |
|
227 | 227 | { |
228 | - if($error->getCode() === $code) |
|
228 | + if ($error->getCode() === $code) |
|
229 | 229 | { |
230 | 230 | return true; |
231 | 231 | } |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | { |
263 | 263 | $result = array(); |
264 | 264 | |
265 | - foreach($this->commands as $command) |
|
265 | + foreach ($this->commands as $command) |
|
266 | 266 | { |
267 | - if($command instanceof $className) |
|
267 | + if ($command instanceof $className) |
|
268 | 268 | { |
269 | 269 | $result[] = $command; |
270 | 270 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | { |
278 | 278 | $commands = $this->getCommands(); |
279 | 279 | |
280 | - if(!empty($commands)) |
|
280 | + if (!empty($commands)) |
|
281 | 281 | { |
282 | 282 | return array_shift($commands); |
283 | 283 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected $translationParams = array(); |
106 | 106 | |
107 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
107 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
108 | 108 | { |
109 | 109 | $this->type = $type; |
110 | 110 | $this->paramsString = html_entity_decode($paramsString); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $this->requireNonDummy(); |
180 | 180 | |
181 | - if($this->hash === '') { |
|
181 | + if ($this->hash === '') { |
|
182 | 182 | $this->hash = md5($this->matchedText); |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | protected function requireNonDummy() : void |
189 | 189 | { |
190 | - if(!$this->isDummy()) |
|
190 | + if (!$this->isDummy()) |
|
191 | 191 | { |
192 | 192 | return; |
193 | 193 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | protected function validate() : \AppUtils\OperationResult |
208 | 208 | { |
209 | - if(!$this->validated) |
|
209 | + if (!$this->validated) |
|
210 | 210 | { |
211 | 211 | $this->requireNonDummy(); |
212 | 212 | $this->validateSyntax(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | public function getValidationResult() : \AppUtils\OperationResult |
221 | 221 | { |
222 | - if(isset($this->validationResult)) |
|
222 | + if (isset($this->validationResult)) |
|
223 | 223 | { |
224 | 224 | return $this->validationResult; |
225 | 225 | } |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | { |
236 | 236 | $validations = array_merge($this->validations, $this->getValidations()); |
237 | 237 | |
238 | - foreach($validations as $validation) |
|
238 | + foreach ($validations as $validation) |
|
239 | 239 | { |
240 | 240 | // break off at the first validation issue |
241 | - if(!$this->validateSyntaxMethod($validation)) |
|
241 | + if (!$this->validateSyntaxMethod($validation)) |
|
242 | 242 | { |
243 | 243 | return; |
244 | 244 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $method = 'validateSyntax_'.$validation; |
251 | 251 | |
252 | - if(!method_exists($this, $method)) |
|
252 | + if (!method_exists($this, $method)) |
|
253 | 253 | { |
254 | 254 | throw new Mailcode_Exception( |
255 | 255 | 'Missing validation method ['.$validation.']', |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | |
275 | 275 | protected function validateSyntax_params_empty() : void |
276 | 276 | { |
277 | - if(!$this->requiresParameters()) |
|
277 | + if (!$this->requiresParameters()) |
|
278 | 278 | { |
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
282 | - if(empty($this->paramsString)) |
|
282 | + if (empty($this->paramsString)) |
|
283 | 283 | { |
284 | 284 | $this->validationResult->makeError( |
285 | 285 | t('Parameters have to be specified.'), |
@@ -291,14 +291,14 @@ discard block |
||
291 | 291 | |
292 | 292 | protected function validateSyntax_params_keywords() : void |
293 | 293 | { |
294 | - if(!$this->supportsLogicKeywords()) |
|
294 | + if (!$this->supportsLogicKeywords()) |
|
295 | 295 | { |
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | 299 | $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString); |
300 | 300 | |
301 | - if(!$this->logicKeywords->isValid()) |
|
301 | + if (!$this->logicKeywords->isValid()) |
|
302 | 302 | { |
303 | 303 | $this->validationResult->makeError( |
304 | 304 | t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(), |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | |
314 | 314 | protected function validateSyntax_params_parse() : void |
315 | 315 | { |
316 | - if(!$this->requiresParameters()) |
|
316 | + if (!$this->requiresParameters()) |
|
317 | 317 | { |
318 | 318 | return; |
319 | 319 | } |
320 | 320 | |
321 | 321 | $this->params = $this->mailcode->getParser()->createStatement($this->paramsString); |
322 | 322 | |
323 | - if(!$this->params->isValid()) |
|
323 | + if (!$this->params->isValid()) |
|
324 | 324 | { |
325 | 325 | $error = $this->params->getValidationResult(); |
326 | 326 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | |
338 | 338 | protected function validateSyntax_type_supported() : void |
339 | 339 | { |
340 | - if(!$this->supportsType() || empty($this->type)) |
|
340 | + if (!$this->supportsType() || empty($this->type)) |
|
341 | 341 | { |
342 | 342 | return; |
343 | 343 | } |
344 | 344 | |
345 | 345 | $types = $this->getSupportedTypes(); |
346 | 346 | |
347 | - if(!in_array($this->type, $types)) |
|
347 | + if (!in_array($this->type, $types)) |
|
348 | 348 | { |
349 | 349 | $this->validationResult->makeError( |
350 | 350 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | protected function validateSyntax_type_unsupported() : void |
360 | 360 | { |
361 | - if($this->supportsType() || empty($this->type)) |
|
361 | + if ($this->supportsType() || empty($this->type)) |
|
362 | 362 | { |
363 | 363 | return; |
364 | 364 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | public function getType() : string |
378 | 378 | { |
379 | - if($this->supportsType()) |
|
379 | + if ($this->supportsType()) |
|
380 | 380 | { |
381 | 381 | return $this->type; |
382 | 382 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | public function getHighlighted() : string |
398 | 398 | { |
399 | - if(!$this->isValid()) |
|
399 | + if (!$this->isValid()) |
|
400 | 400 | { |
401 | 401 | return ''; |
402 | 402 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | public function getParamsString() : string |
409 | 409 | { |
410 | - if($this->requiresParameters()) |
|
410 | + if ($this->requiresParameters()) |
|
411 | 411 | { |
412 | 412 | return $this->paramsString; |
413 | 413 | } |
@@ -442,22 +442,22 @@ discard block |
||
442 | 442 | |
443 | 443 | public final function getCommandType() : string |
444 | 444 | { |
445 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
445 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
446 | 446 | { |
447 | 447 | return 'Closing'; |
448 | 448 | } |
449 | 449 | |
450 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
450 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
451 | 451 | { |
452 | 452 | return 'Opening'; |
453 | 453 | } |
454 | 454 | |
455 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
455 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
456 | 456 | { |
457 | 457 | return 'Sibling'; |
458 | 458 | } |
459 | 459 | |
460 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
460 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
461 | 461 | { |
462 | 462 | return 'Standalone'; |
463 | 463 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
509 | 509 | { |
510 | - if($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
510 | + if ($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
511 | 511 | { |
512 | 512 | return $this->logicKeywords; |
513 | 513 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | */ |
542 | 542 | public function getTranslationParam(string $name) |
543 | 543 | { |
544 | - if(isset($this->translationParams[$name])) |
|
544 | + if (isset($this->translationParams[$name])) |
|
545 | 545 | { |
546 | 546 | return $this->translationParams[$name]; |
547 | 547 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $internalFormat = $command->getTranslationParam('internal_format'); |
54 | 54 | |
55 | - if(empty($internalFormat)) |
|
55 | + if (empty($internalFormat)) |
|
56 | 56 | { |
57 | 57 | $internalFormat = self::DEFAULT_INTERNAL_FORMAT; |
58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $chars = ConvertHelper::string2array($formatString); |
71 | 71 | $result = array(); |
72 | 72 | |
73 | - foreach($chars as $char) |
|
73 | + foreach ($chars as $char) |
|
74 | 74 | { |
75 | - if(!isset($this->charTable[$char])) |
|
75 | + if (!isset($this->charTable[$char])) |
|
76 | 76 | { |
77 | 77 | throw new Mailcode_Translator_Exception( |
78 | 78 | 'Unknown date format string character', |