@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $command->getID() |
64 | 64 | ); |
65 | 65 | |
66 | - if(!class_exists($class)) |
|
66 | + if (!class_exists($class)) |
|
67 | 67 | { |
68 | 68 | $class = sprintf( |
69 | 69 | 'Mailcode\Translator\Syntax\%s\%s', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
75 | - if(!class_exists($class)) |
|
75 | + if (!class_exists($class)) |
|
76 | 76 | { |
77 | 77 | throw new Mailcode_Translator_Exception( |
78 | 78 | sprintf('Unknown command %s in translator', $command->getID()), |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $translator = new $class($command); |
88 | 88 | |
89 | - if($translator instanceof Mailcode_Translator_Command) |
|
89 | + if ($translator instanceof Mailcode_Translator_Command) |
|
90 | 90 | { |
91 | 91 | return $translator; |
92 | 92 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $subject = $safeguard->makeSafe(); |
116 | 116 | |
117 | - if(!$safeguard->hasPlaceholders()) |
|
117 | + if (!$safeguard->hasPlaceholders()) |
|
118 | 118 | { |
119 | 119 | return $subject; |
120 | 120 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $replaces = array(); |
125 | 125 | |
126 | - foreach($placeholders as $placeholder) |
|
126 | + foreach ($placeholders as $placeholder) |
|
127 | 127 | { |
128 | 128 | $command = $placeholder->getCommand(); |
129 | 129 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | // All other special characters have to be escaped |
73 | 73 | // with two backslashes. |
74 | - foreach($this->regexSpecialChars as $char) |
|
74 | + foreach ($this->regexSpecialChars as $char) |
|
75 | 75 | { |
76 | 76 | $string = str_replace($char, '\\'.$char, $string); |
77 | 77 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function addURLEncoding(Mailcode_Commands_Command $command, string $statement) : string |
87 | 87 | { |
88 | - if(!$command instanceof URLEncodingInterface) |
|
88 | + if (!$command instanceof URLEncodingInterface) |
|
89 | 89 | { |
90 | 90 | return $statement; |
91 | 91 | } |
92 | 92 | |
93 | - if($command->isURLEncoded()) |
|
93 | + if ($command->isURLEncoded()) |
|
94 | 94 | { |
95 | 95 | return sprintf( |
96 | 96 | '${esc.url($%s)}', |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | - if($command->isURLDecoded()) |
|
101 | + if ($command->isURLDecoded()) |
|
102 | 102 | { |
103 | 103 | return sprintf( |
104 | 104 | '${esc.unurl($%s)}', |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $varName = '$'.ltrim($varName, '$'); |
118 | 118 | |
119 | - if($absolute) |
|
119 | + if ($absolute) |
|
120 | 120 | { |
121 | 121 | $varName = sprintf('${price.abs(%s)}', $varName); |
122 | 122 | } |
@@ -17,16 +17,16 @@ |
||
17 | 17 | $statements = array(); |
18 | 18 | $statements[] = $this->renderURL($command); |
19 | 19 | |
20 | - if($command->isTrackingEnabled()) |
|
20 | + if ($command->isTrackingEnabled()) |
|
21 | 21 | { |
22 | 22 | $statements[] = $this->renderTracking($command); |
23 | 23 | } |
24 | 24 | |
25 | - if($command->hasQueryParams()) |
|
25 | + if ($command->hasQueryParams()) |
|
26 | 26 | { |
27 | 27 | $params = $command->getQueryParams(); |
28 | 28 | |
29 | - foreach($params as $name => $value) |
|
29 | + foreach ($params as $name => $value) |
|
30 | 30 | { |
31 | 31 | $statements[] = $this->renderQueryParam($name, $value); |
32 | 32 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | static $ids = array(); |
49 | 49 | |
50 | - if(empty($ids)) { |
|
50 | + if (empty($ids)) { |
|
51 | 51 | $ids = FileHelper::createFileFinder(__DIR__.'/Commands/Command') |
52 | 52 | ->getPHPClassNames(); |
53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getAll() : array |
67 | 67 | { |
68 | - if(!empty($this->commands)) { |
|
68 | + if (!empty($this->commands)) { |
|
69 | 69 | return $this->commands; |
70 | 70 | } |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $result = array(); |
75 | 75 | |
76 | - foreach($ids as $id) |
|
76 | + foreach ($ids as $id) |
|
77 | 77 | { |
78 | 78 | $result[] = $this->getDummyCommand($id); |
79 | 79 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | static $instances = array(); |
100 | 100 | |
101 | - if(!isset($instances[$id])) |
|
101 | + if (!isset($instances[$id])) |
|
102 | 102 | { |
103 | 103 | $instances[$id] = $this->createCommand($id, '__dummy', '', ''); |
104 | 104 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | { |
120 | 120 | $items = $this->getAll(); |
121 | 121 | |
122 | - foreach($items as $item) |
|
122 | + foreach ($items as $item) |
|
123 | 123 | { |
124 | - if($item->getName() === $name) { |
|
124 | + if ($item->getName() === $name) { |
|
125 | 125 | return $item->getID(); |
126 | 126 | } |
127 | 127 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | { |
155 | 155 | $items = $this->getAll(); |
156 | 156 | |
157 | - foreach($items as $item) |
|
157 | + foreach ($items as $item) |
|
158 | 158 | { |
159 | - if($item->getName() === $name) { |
|
159 | + if ($item->getName() === $name) { |
|
160 | 160 | return true; |
161 | 161 | } |
162 | 162 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | $class = $this->resolveClassName($id, $type); |
178 | 178 | |
179 | - if(!class_exists($class)) |
|
179 | + if (!class_exists($class)) |
|
180 | 180 | { |
181 | 181 | throw new Mailcode_Factory_Exception( |
182 | 182 | 'No such command', |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $command = new $class($type, $params, $matchedString); |
193 | 193 | |
194 | - if($command instanceof Mailcode_Commands_Command) |
|
194 | + if ($command instanceof Mailcode_Commands_Command) |
|
195 | 195 | { |
196 | 196 | return $command; |
197 | 197 | } |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | |
213 | 213 | $dummy = $this->getDummyCommand($id); |
214 | 214 | |
215 | - if($dummy->supportsType()) |
|
215 | + if ($dummy->supportsType()) |
|
216 | 216 | { |
217 | - if(empty($type)) |
|
217 | + if (empty($type)) |
|
218 | 218 | { |
219 | 219 | $type = $dummy->getDefaultType(); |
220 | 220 | } |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | */ |
253 | 253 | private function getDummyCommand(string $id) : Mailcode_Commands_Command |
254 | 254 | { |
255 | - if(isset(self::$dummyCommands[$id])) { |
|
255 | + if (isset(self::$dummyCommands[$id])) { |
|
256 | 256 | return self::$dummyCommands[$id]; |
257 | 257 | } |
258 | 258 | |
259 | 259 | $class = 'Mailcode\Mailcode_Commands_Command_'.$id; |
260 | 260 | $cmd = new $class('__dummy'); |
261 | 261 | |
262 | - if($cmd instanceof Mailcode_Commands_Command) |
|
262 | + if ($cmd instanceof Mailcode_Commands_Command) |
|
263 | 263 | { |
264 | 264 | self::$dummyCommands[$id] = $cmd; |
265 | 265 | return $cmd; |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $result = array(); |
285 | 285 | $commands = $this->getAll(); |
286 | 286 | |
287 | - foreach($commands as $command) |
|
287 | + foreach ($commands as $command) |
|
288 | 288 | { |
289 | - if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
289 | + if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent) |
|
290 | 290 | { |
291 | 291 | $result[] = $command; |
292 | 292 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | private int $instanceID; |
134 | 134 | |
135 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
135 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
136 | 136 | { |
137 | 137 | self::$instanceCounter++; |
138 | 138 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $this->requireNonDummy(); |
225 | 225 | |
226 | - if($this->hash === '') { |
|
226 | + if ($this->hash === '') { |
|
227 | 227 | $this->hash = md5($this->matchedText); |
228 | 228 | } |
229 | 229 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function requireNonDummy() : void |
238 | 238 | { |
239 | - if(!$this->isDummy()) |
|
239 | + if (!$this->isDummy()) |
|
240 | 240 | { |
241 | 241 | return; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | protected function validate() : OperationResult |
257 | 257 | { |
258 | - if(!$this->validated) |
|
258 | + if (!$this->validated) |
|
259 | 259 | { |
260 | 260 | $this->requireNonDummy(); |
261 | 261 | $this->validateSyntax(); |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | { |
276 | 276 | $validations = $this->resolveValidations(); |
277 | 277 | |
278 | - foreach($validations as $validation) |
|
278 | + foreach ($validations as $validation) |
|
279 | 279 | { |
280 | 280 | // break off at the first validation issue |
281 | - if(!$this->validateSyntaxMethod($validation)) |
|
281 | + if (!$this->validateSyntaxMethod($validation)) |
|
282 | 282 | { |
283 | 283 | return; |
284 | 284 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | { |
303 | 303 | $method = 'validateSyntax_'.$validation; |
304 | 304 | |
305 | - if(!method_exists($this, $method)) |
|
305 | + if (!method_exists($this, $method)) |
|
306 | 306 | { |
307 | 307 | throw new CommandException( |
308 | 308 | 'Missing validation method ['.$validation.']', |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | public function validateNesting() : OperationResult |
334 | 334 | { |
335 | - if($this->nestingValidated) |
|
335 | + if ($this->nestingValidated) |
|
336 | 336 | { |
337 | 337 | return $this->validationResult; |
338 | 338 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | public function getType() : string |
358 | 358 | { |
359 | - if($this->supportsType()) |
|
359 | + if ($this->supportsType()) |
|
360 | 360 | { |
361 | 361 | return $this->type; |
362 | 362 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | public function getHighlighted() : string |
378 | 378 | { |
379 | - if(!$this->isValid()) |
|
379 | + if (!$this->isValid()) |
|
380 | 380 | { |
381 | 381 | return ''; |
382 | 382 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | public function getParamsString() : string |
388 | 388 | { |
389 | - if($this->requiresParameters()) |
|
389 | + if ($this->requiresParameters()) |
|
390 | 390 | { |
391 | 391 | return $this->paramsString; |
392 | 392 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function requireParams() : Mailcode_Parser_Statement |
407 | 407 | { |
408 | - if(isset($this->params)) |
|
408 | + if (isset($this->params)) |
|
409 | 409 | { |
410 | 410 | return $this->params; |
411 | 411 | } |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | */ |
438 | 438 | final public function getCommandType() : string |
439 | 439 | { |
440 | - if($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
440 | + if ($this instanceof Mailcode_Commands_Command_Type_Closing) |
|
441 | 441 | { |
442 | 442 | return 'Closing'; |
443 | 443 | } |
444 | 444 | |
445 | - if($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
445 | + if ($this instanceof Mailcode_Commands_Command_Type_Opening) |
|
446 | 446 | { |
447 | 447 | return 'Opening'; |
448 | 448 | } |
449 | 449 | |
450 | - if($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
450 | + if ($this instanceof Mailcode_Commands_Command_Type_Sibling) |
|
451 | 451 | { |
452 | 452 | return 'Sibling'; |
453 | 453 | } |
454 | 454 | |
455 | - if($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
455 | + if ($this instanceof Mailcode_Commands_Command_Type_Standalone) |
|
456 | 456 | { |
457 | 457 | return 'Standalone'; |
458 | 458 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function getLogicKeywords() : Mailcode_Commands_LogicKeywords |
495 | 495 | { |
496 | - if(isset($this->logicKeywords) && $this->supportsLogicKeywords()) |
|
496 | + if (isset($this->logicKeywords) && $this->supportsLogicKeywords()) |
|
497 | 497 | { |
498 | 498 | return $this->logicKeywords; |
499 | 499 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | protected function getValidator() : Mailcode_Parser_Statement_Validator |
525 | 525 | { |
526 | - if(isset($this->validator)) |
|
526 | + if (isset($this->validator)) |
|
527 | 527 | { |
528 | 528 | return $this->validator; |
529 | 529 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $tokens = $this->params->getInfo()->getTokens(); |
59 | 59 | $allowed = $this->resolveActiveTokens(); |
60 | 60 | |
61 | - if(count($tokens) > count($allowed)) |
|
61 | + if (count($tokens) > count($allowed)) |
|
62 | 62 | { |
63 | 63 | $this->validationResult->makeError( |
64 | 64 | t('Unknown parameters found:').' '. |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | $encodings = $this->getSupportedEncodings(); |
83 | 83 | |
84 | - foreach($encodings as $keyword) |
|
84 | + foreach ($encodings as $keyword) |
|
85 | 85 | { |
86 | 86 | $token = $this->getEncodingToken($keyword); |
87 | - if($token) |
|
87 | + if ($token) |
|
88 | 88 | { |
89 | 89 | $allowed[] = $token; |
90 | 90 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @return $this |
33 | 33 | * @throws ParamsException |
34 | 34 | */ |
35 | - public function setURLDecoding(bool $decode=true) : self; |
|
35 | + public function setURLDecoding(bool $decode = true) : self; |
|
36 | 36 | |
37 | 37 | public function isURLDecoded(): bool; |
38 | 38 | } |