@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected $parent = null; |
111 | 111 | |
112 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
112 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
113 | 113 | { |
114 | 114 | $this->type = $type; |
115 | 115 | $this->paramsString = html_entity_decode($paramsString); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | $this->requireNonDummy(); |
207 | 207 | |
208 | - if($this->hash === '') { |
|
208 | + if ($this->hash === '') { |
|
209 | 209 | $this->hash = md5($this->matchedText); |
210 | 210 | } |
211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | protected function requireNonDummy() : void |
216 | 216 | { |
217 | - if(!$this->isDummy()) |
|
217 | + if (!$this->isDummy()) |
|
218 | 218 | { |
219 | 219 | return; |
220 | 220 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | protected function validate() : \AppUtils\OperationResult |
235 | 235 | { |
236 | - if(!$this->validated) |
|
236 | + if (!$this->validated) |
|
237 | 237 | { |
238 | 238 | $this->requireNonDummy(); |
239 | 239 | $this->validateSyntax(); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | public function getValidationResult() : \AppUtils\OperationResult |
248 | 248 | { |
249 | - if(isset($this->validationResult)) |
|
249 | + if (isset($this->validationResult)) |
|
250 | 250 | { |
251 | 251 | return $this->validationResult; |
252 | 252 | } |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | { |
263 | 263 | $validations = array_merge($this->validations, $this->getValidations()); |
264 | 264 | |
265 | - foreach($validations as $validation) |
|
265 | + foreach ($validations as $validation) |
|
266 | 266 | { |
267 | 267 | // break off at the first validation issue |
268 | - if(!$this->validateSyntaxMethod($validation)) |
|
268 | + if (!$this->validateSyntaxMethod($validation)) |
|
269 | 269 | { |
270 | 270 | return; |
271 | 271 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | $method = 'validateSyntax_'.$validation; |
278 | 278 | |
279 | - if(!method_exists($this, $method)) |
|
279 | + if (!method_exists($this, $method)) |
|
280 | 280 | { |
281 | 281 | throw new Mailcode_Exception( |
282 | 282 | 'Missing validation method ['.$validation.']', |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | |
302 | 302 | protected function validateSyntax_params_empty() : void |
303 | 303 | { |
304 | - if(!$this->requiresParameters()) |
|
304 | + if (!$this->requiresParameters()) |
|
305 | 305 | { |
306 | 306 | return; |
307 | 307 | } |
308 | 308 | |
309 | - if(empty($this->paramsString)) |
|
309 | + if (empty($this->paramsString)) |
|
310 | 310 | { |
311 | 311 | $this->validationResult->makeError( |
312 | 312 | t('Parameters have to be specified.'), |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | |
319 | 319 | protected function validateSyntax_params_keywords() : void |
320 | 320 | { |
321 | - if(!$this->supportsLogicKeywords()) |
|
321 | + if (!$this->supportsLogicKeywords()) |
|
322 | 322 | { |
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | 326 | $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString); |
327 | 327 | |
328 | - if(!$this->logicKeywords->isValid()) |
|
328 | + if (!$this->logicKeywords->isValid()) |
|
329 | 329 | { |
330 | 330 | $this->validationResult->makeError( |
331 | 331 | t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(), |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | |
341 | 341 | protected function validateSyntax_params_parse() : void |
342 | 342 | { |
343 | - if(!$this->requiresParameters()) |
|
343 | + if (!$this->requiresParameters()) |
|
344 | 344 | { |
345 | 345 | return; |
346 | 346 | } |
347 | 347 | |
348 | 348 | $this->params = $this->mailcode->getParser()->createStatement($this->paramsString); |
349 | 349 | |
350 | - if(!$this->params->isValid()) |
|
350 | + if (!$this->params->isValid()) |
|
351 | 351 | { |
352 | 352 | $error = $this->params->getValidationResult(); |
353 | 353 | |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | |
365 | 365 | protected function validateSyntax_type_supported() : void |
366 | 366 | { |
367 | - if(!$this->supportsType() || empty($this->type)) |
|
367 | + if (!$this->supportsType() || empty($this->type)) |
|
368 | 368 | { |
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | 372 | $types = $this->getSupportedTypes(); |
373 | 373 | |
374 | - if(!in_array($this->type, $types)) |
|
374 | + if (!in_array($this->type, $types)) |
|
375 | 375 | { |
376 | 376 | $this->validationResult->makeError( |
377 | 377 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | protected function validateSyntax_type_unsupported() : void |
387 | 387 | { |
388 | - if($this->supportsType() || empty($this->type)) |
|
388 | + if ($this->supportsType() || empty($this->type)) |
|
389 | 389 | { |
390 | 390 | return; |
391 | 391 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | public function getType() : string |
405 | 405 | { |
406 | - if($this->supportsType()) |
|
406 | + if ($this->supportsType()) |
|
407 | 407 | { |
408 | 408 | return $this->type; |
409 | 409 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | public function getHighlighted() : string |
425 | 425 | { |
426 | - if(!$this->isValid()) |
|
426 | + if (!$this->isValid()) |
|
427 | 427 | { |
428 | 428 | return ''; |
429 | 429 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | public function getParamsString() : string |
436 | 436 | { |
437 | - if($this->requiresParameters()) |
|
437 | + if ($this->requiresParameters()) |
|
438 | 438 | { |
439 | 439 | return $this->paramsString; |
440 | 440 | } |
@@ -469,22 +469,22 @@ discard block |
||
469 | 469 | |
470 | 470 | public final function getCommandType() : string |
471 | 471 | { |
472 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
472 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
473 | 473 | { |
474 | 474 | return 'Closing'; |
475 | 475 | } |
476 | 476 | |
477 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
477 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
478 | 478 | { |
479 | 479 | return 'Opening'; |
480 | 480 | } |
481 | 481 | |
482 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
482 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
483 | 483 | { |
484 | 484 | return 'Sibling'; |
485 | 485 | } |
486 | 486 | |
487 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
487 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
488 | 488 | { |
489 | 489 | return 'Standalone'; |
490 | 490 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
536 | 536 | { |
537 | - if($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
537 | + if ($this->supportsLogicKeywords() && isset($this->logicKeywords)) |
|
538 | 538 | { |
539 | 539 | return $this->logicKeywords; |
540 | 540 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public function getTranslationParam(string $name) |
570 | 570 | { |
571 | - if(isset($this->translationParams[$name])) |
|
571 | + if (isset($this->translationParams[$name])) |
|
572 | 572 | { |
573 | 573 | return $this->translationParams[$name]; |
574 | 574 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $total = count($matches[0]); |
80 | 80 | |
81 | - for($i=0; $i < $total; $i++) |
|
81 | + for ($i = 0; $i < $total; $i++) |
|
82 | 82 | { |
83 | 83 | $match = $this->parseMatch($matches, $i); |
84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | protected function prepareString(string $subject) : string |
92 | 92 | { |
93 | - if(!ConvertHelper::isStringHTML($subject)) |
|
93 | + if (!ConvertHelper::isStringHTML($subject)) |
|
94 | 94 | { |
95 | 95 | return $subject; |
96 | 96 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $name = $match->getName(); |
113 | 113 | |
114 | - if(!$this->commands->nameExists($name)) |
|
114 | + if (!$this->commands->nameExists($name)) |
|
115 | 115 | { |
116 | 116 | $collection->addErrorMessage( |
117 | 117 | $match->getMatchedString(), |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $match->getMatchedString() |
129 | 129 | ); |
130 | 130 | |
131 | - if(!$cmd->isValid()) |
|
131 | + if (!$cmd->isValid()) |
|
132 | 132 | { |
133 | 133 | $collection->addInvalidCommand($cmd); |
134 | 134 | return; |
@@ -137,17 +137,17 @@ discard block |
||
137 | 137 | $collection->addCommand($cmd); |
138 | 138 | |
139 | 139 | // Set the command's parent from the stack, if any is present. |
140 | - if(!empty($this->stack)) |
|
140 | + if (!empty($this->stack)) |
|
141 | 141 | { |
142 | 142 | $cmd->setParent($this->stack[array_key_last($this->stack)]); |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Handle opening and closing commands, adding and removing from the stack. |
146 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
146 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
147 | 147 | { |
148 | 148 | $this->stack[] = $cmd; |
149 | 149 | } |
150 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
150 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
151 | 151 | { |
152 | 152 | array_pop($this->stack); |
153 | 153 | } |
@@ -174,16 +174,16 @@ discard block |
||
174 | 174 | // 5 = parameter type command, type |
175 | 175 | // 6 = parameter type command, params |
176 | 176 | |
177 | - if(!empty($matches[1][$index])) |
|
177 | + if (!empty($matches[1][$index])) |
|
178 | 178 | { |
179 | 179 | $name = $matches[1][$index]; |
180 | 180 | } |
181 | - else if(!empty($matches[2][$index])) |
|
181 | + else if (!empty($matches[2][$index])) |
|
182 | 182 | { |
183 | 183 | $name = $matches[2][$index]; |
184 | 184 | $params = $matches[3][$index]; |
185 | 185 | } |
186 | - else if(!empty($matches[4][$index])) |
|
186 | + else if (!empty($matches[4][$index])) |
|
187 | 187 | { |
188 | 188 | $name = $matches[4][$index]; |
189 | 189 | $type = $matches[5][$index]; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $var = $this->validator->createVariable(); |
35 | 35 | |
36 | - if($var->isValid()) |
|
36 | + if ($var->isValid()) |
|
37 | 37 | { |
38 | 38 | $this->variableToken = $var->getToken(); |
39 | 39 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getVariable() : Mailcode_Variables_Variable |
55 | 55 | { |
56 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
56 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
57 | 57 | { |
58 | 58 | return $this->variableToken->getVariable(); |
59 | 59 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | { |
102 | 102 | $parent = $subject->getParent(); |
103 | 103 | |
104 | - if($parent === null) |
|
104 | + if ($parent === null) |
|
105 | 105 | { |
106 | 106 | return null; |
107 | 107 | } |
108 | 108 | |
109 | - if($parent instanceof Mailcode_Commands_Command_For) |
|
109 | + if ($parent instanceof Mailcode_Commands_Command_For) |
|
110 | 110 | { |
111 | 111 | return $parent; |
112 | 112 | } |