@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param bool $highlighted |
| 33 | 33 | * @return Mailcode_Renderer |
| 34 | 34 | */ |
| 35 | - public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer |
|
| 35 | + public function setOutputHighlighted(bool $highlighted = true) : Mailcode_Renderer |
|
| 36 | 36 | { |
| 37 | 37 | $this->highlighted = $highlighted; |
| 38 | 38 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return $this->command2string(Mailcode_Factory::showSnippet($snippetName)); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setVar(string $variableName, string $value, bool $quoteValue=false) : string |
|
| 58 | + public function setVar(string $variableName, string $value, bool $quoteValue = false) : string |
|
| 59 | 59 | { |
| 60 | 60 | return $this->command2string(Mailcode_Factory::setVar($variableName, $value, $quoteValue)); |
| 61 | 61 | } |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | return $this->command2string(Mailcode_Factory::setVarString($variableName, $value)); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function if(string $condition, string $type='') : string |
|
| 68 | + public function if (string $condition, string $type = '') : string |
|
| 69 | 69 | { |
| 70 | - return $this->command2string(Mailcode_Factory::if($condition, $type)); |
|
| 70 | + return $this->command2string(Mailcode_Factory::if ($condition, $type)); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
|
| 73 | + public function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string |
|
| 74 | 74 | { |
| 75 | 75 | return $this->command2string(Mailcode_Factory::ifVar($variable, $operand, $value, $quoteValue)); |
| 76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return $this->command2string(Mailcode_Factory::ifVarString($variable, $operand, $value)); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : string |
|
| 83 | + public function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : string |
|
| 84 | 84 | { |
| 85 | 85 | return $this->command2string(Mailcode_Factory::ifVarEquals($variable, $value, $quoteValue)); |
| 86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return $this->command2string(Mailcode_Factory::ifVarEqualsString($variable, $value)); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string |
|
| 93 | + public function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string |
|
| 94 | 94 | { |
| 95 | 95 | return $this->command2string(Mailcode_Factory::ifVarNotEquals($variable, $value, $quoteValue)); |
| 96 | 96 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | return $this->command2string(Mailcode_Factory::ifVarNotEqualsString($variable, $value)); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function elseIf(string $condition, string $type='') : string |
|
| 103 | + public function elseIf (string $condition, string $type = '') : string |
|
| 104 | 104 | { |
| 105 | - return $this->command2string(Mailcode_Factory::elseIf($condition, $type)); |
|
| 105 | + return $this->command2string(Mailcode_Factory::elseIf ($condition, $type)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
|
| 108 | + public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string |
|
| 109 | 109 | { |
| 110 | 110 | return $this->command2string(Mailcode_Factory::elseIfVar($variable, $operand, $value, $quoteValue)); |
| 111 | 111 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | return $this->command2string(Mailcode_Factory::elseIfVarString($variable, $operand, $value)); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : string |
|
| 118 | + public function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : string |
|
| 119 | 119 | { |
| 120 | 120 | return $this->command2string(Mailcode_Factory::elseIfVarEquals($variable, $value, $quoteValue)); |
| 121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return $this->command2string(Mailcode_Factory::elseIfVarEqualsString($variable, $value)); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string |
|
| 128 | + public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string |
|
| 129 | 129 | { |
| 130 | 130 | return $this->command2string(Mailcode_Factory::elseIfVarNotEquals($variable, $value, $quoteValue)); |
| 131 | 131 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | protected function command2string(Mailcode_Commands_Command $command) : string |
| 154 | 154 | { |
| 155 | - if($this->highlighted) |
|
| 155 | + if ($this->highlighted) |
|
| 156 | 156 | { |
| 157 | 157 | return $command->getHighlighted(); |
| 158 | 158 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | protected $comment = ''; |
| 81 | 81 | |
| 82 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
| 82 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
| 83 | 83 | { |
| 84 | 84 | $this->type = $type; |
| 85 | 85 | $this->paramsString = html_entity_decode($paramsString); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $this->requireNonDummy(); |
| 152 | 152 | |
| 153 | - if($this->hash === '') { |
|
| 153 | + if ($this->hash === '') { |
|
| 154 | 154 | $this->hash = md5($this->matchedText); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | protected function requireNonDummy() : void |
| 161 | 161 | { |
| 162 | - if(!$this->isDummy()) |
|
| 162 | + if (!$this->isDummy()) |
|
| 163 | 163 | { |
| 164 | 164 | return; |
| 165 | 165 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $this->requireNonDummy(); |
| 182 | 182 | |
| 183 | - if(isset($this->validationResult)) |
|
| 183 | + if (isset($this->validationResult)) |
|
| 184 | 184 | { |
| 185 | 185 | return $this->validationResult; |
| 186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | public function getValidationResult() : \AppUtils\OperationResult |
| 196 | 196 | { |
| 197 | - if(isset($this->validationResult)) |
|
| 197 | + if (isset($this->validationResult)) |
|
| 198 | 198 | { |
| 199 | 199 | return $this->validationResult; |
| 200 | 200 | } |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $validations = array_merge($this->validations, $this->getValidations()); |
| 212 | 212 | |
| 213 | - foreach($validations as $validation) |
|
| 213 | + foreach ($validations as $validation) |
|
| 214 | 214 | { |
| 215 | 215 | $method = 'validateSyntax_'.$validation; |
| 216 | 216 | |
| 217 | - if(!method_exists($this, $method)) |
|
| 217 | + if (!method_exists($this, $method)) |
|
| 218 | 218 | { |
| 219 | 219 | throw new Mailcode_Exception( |
| 220 | 220 | 'Missing validation method', |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $this->$method(); |
| 231 | 231 | |
| 232 | 232 | // break off at the first validation issue |
| 233 | - if(!$this->validationResult->isValid()) |
|
| 233 | + if (!$this->validationResult->isValid()) |
|
| 234 | 234 | { |
| 235 | 235 | return; |
| 236 | 236 | } |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | protected function validateSyntax_params() : void |
| 246 | 246 | { |
| 247 | - if(!$this->requiresParameters()) |
|
| 247 | + if (!$this->requiresParameters()) |
|
| 248 | 248 | { |
| 249 | 249 | return; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if(empty($this->paramsString)) |
|
| 252 | + if (empty($this->paramsString)) |
|
| 253 | 253 | { |
| 254 | 254 | $this->validationResult->makeError( |
| 255 | 255 | t('Parameters have to be specified.'), |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $this->params = $this->mailcode->getParser()->createStatement($this->paramsString); |
| 262 | 262 | |
| 263 | - if(!$this->params->isValid()) |
|
| 263 | + if (!$this->params->isValid()) |
|
| 264 | 264 | { |
| 265 | 265 | $error = $this->params->getValidationResult(); |
| 266 | 266 | |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | protected function validateSyntax_type_supported() : void |
| 275 | 275 | { |
| 276 | - if(!$this->supportsType() || empty($this->type)) |
|
| 276 | + if (!$this->supportsType() || empty($this->type)) |
|
| 277 | 277 | { |
| 278 | 278 | return; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $types = $this->getSupportedTypes(); |
| 282 | 282 | |
| 283 | - if(!in_array($this->type, $types)) |
|
| 283 | + if (!in_array($this->type, $types)) |
|
| 284 | 284 | { |
| 285 | 285 | $this->validationResult->makeError( |
| 286 | 286 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | protected function validateSyntax_type_unsupported() : void |
| 296 | 296 | { |
| 297 | - if($this->supportsType() || empty($this->type)) |
|
| 297 | + if ($this->supportsType() || empty($this->type)) |
|
| 298 | 298 | { |
| 299 | 299 | return; |
| 300 | 300 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | public function getType() : string |
| 314 | 314 | { |
| 315 | - if($this->supportsType()) |
|
| 315 | + if ($this->supportsType()) |
|
| 316 | 316 | { |
| 317 | 317 | return $this->type; |
| 318 | 318 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | public function getHighlighted() : string |
| 334 | 334 | { |
| 335 | - if(!$this->isValid()) |
|
| 335 | + if (!$this->isValid()) |
|
| 336 | 336 | { |
| 337 | 337 | return ''; |
| 338 | 338 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | public function getParamsString() : string |
| 345 | 345 | { |
| 346 | - if($this->requiresParameters()) |
|
| 346 | + if ($this->requiresParameters()) |
|
| 347 | 347 | { |
| 348 | 348 | return $this->paramsString; |
| 349 | 349 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | public function getNormalized() : string |
| 372 | 372 | { |
| 373 | - if(!$this->isValid()) |
|
| 373 | + if (!$this->isValid()) |
|
| 374 | 374 | { |
| 375 | 375 | return ''; |
| 376 | 376 | } |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | $parts = array(); |
| 379 | 379 | $parts[] = '{'.$this->getName(); |
| 380 | 380 | |
| 381 | - if($this->supportsType() && $this->hasType()) |
|
| 381 | + if ($this->supportsType() && $this->hasType()) |
|
| 382 | 382 | { |
| 383 | 383 | $parts[] = ' '.$this->getType(); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - if($this->requiresParameters() && isset($this->params)) |
|
| 386 | + if ($this->requiresParameters() && isset($this->params)) |
|
| 387 | 387 | { |
| 388 | 388 | $parts[] = ': '; |
| 389 | 389 | $parts[] = $this->params->getNormalized(); |
@@ -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(isset($this->validationResult)) |
|
| 210 | + if (isset($this->validationResult)) |
|
| 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 | } |
@@ -243,9 +243,9 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | $result = array(); |
| 245 | 245 | |
| 246 | - foreach($this->commands as $command) |
|
| 246 | + foreach ($this->commands as $command) |
|
| 247 | 247 | { |
| 248 | - if($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
| 248 | + if ($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
| 249 | 249 | { |
| 250 | 250 | $result[] = $command; |
| 251 | 251 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $commands = $this->getCommands(); |
| 260 | 260 | |
| 261 | - if(!empty($commands)) |
|
| 261 | + if (!empty($commands)) |
|
| 262 | 262 | { |
| 263 | 263 | return array_shift($commands); |
| 264 | 264 | } |