@@ -24,17 +24,17 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | const ERROR_UNEXPECTED_COMMAND_TYPE = 50002; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Renderer |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Renderer |
|
| 29 | + */ |
|
| 30 | 30 | protected static $renderer; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Creates a ShowVariable command. |
|
| 34 | - * |
|
| 35 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 36 | - * @return Mailcode_Commands_Command_ShowVariable |
|
| 37 | - */ |
|
| 32 | + /** |
|
| 33 | + * Creates a ShowVariable command. |
|
| 34 | + * |
|
| 35 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 36 | + * @return Mailcode_Commands_Command_ShowVariable |
|
| 37 | + */ |
|
| 38 | 38 | public static function showVar(string $variableName) : Mailcode_Commands_Command_ShowVariable |
| 39 | 39 | { |
| 40 | 40 | $variableName = self::_filterVariableName($variableName); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | return $cmd; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Creates a ShowSnippet command. |
|
| 55 | - * |
|
| 56 | - * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 57 | - * @return Mailcode_Commands_Command_ShowSnippet |
|
| 58 | - */ |
|
| 53 | + /** |
|
| 54 | + * Creates a ShowSnippet command. |
|
| 55 | + * |
|
| 56 | + * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 57 | + * @return Mailcode_Commands_Command_ShowSnippet |
|
| 58 | + */ |
|
| 59 | 59 | public static function showSnippet(string $snippetName) : Mailcode_Commands_Command_ShowSnippet |
| 60 | 60 | { |
| 61 | 61 | $snippetName = self::_filterVariableName($snippetName); |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | return $cmd; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Creates a SetVariable command. |
|
| 76 | - * |
|
| 77 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 78 | - * @param string $value |
|
| 79 | - * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 80 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 81 | - * @throws Mailcode_Factory_Exception |
|
| 82 | - * |
|
| 83 | - * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 84 | - */ |
|
| 74 | + /** |
|
| 75 | + * Creates a SetVariable command. |
|
| 76 | + * |
|
| 77 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 78 | + * @param string $value |
|
| 79 | + * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 80 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 81 | + * @throws Mailcode_Factory_Exception |
|
| 82 | + * |
|
| 83 | + * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 84 | + */ |
|
| 85 | 85 | public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
| 86 | 86 | { |
| 87 | 87 | $variableName = self::_filterVariableName($variableName); |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | return $cmd; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Like setVar(), but treats the value as a string literal |
|
| 109 | - * and automatically adds quotes to it. |
|
| 110 | - * |
|
| 111 | - * @param string $variableName |
|
| 112 | - * @param string $value |
|
| 113 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 114 | - */ |
|
| 107 | + /** |
|
| 108 | + * Like setVar(), but treats the value as a string literal |
|
| 109 | + * and automatically adds quotes to it. |
|
| 110 | + * |
|
| 111 | + * @param string $variableName |
|
| 112 | + * @param string $value |
|
| 113 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 114 | + */ |
|
| 115 | 115 | public static function setVarString(string $variableName, string $value) : Mailcode_Commands_Command_SetVariable |
| 116 | 116 | { |
| 117 | 117 | return self::setVar($variableName, $value, true); |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | return '$'.ltrim($name, '$'); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
| 383 | - * |
|
| 384 | - * @param string $string |
|
| 385 | - * @return string |
|
| 386 | - */ |
|
| 381 | + /** |
|
| 382 | + * Quotes a string literal: adds the quotes, and escapes any quotes already present in it. |
|
| 383 | + * |
|
| 384 | + * @param string $string |
|
| 385 | + * @return string |
|
| 386 | + */ |
|
| 387 | 387 | protected static function _quoteString(string $string) : string |
| 388 | 388 | { |
| 389 | 389 | return '"'.str_replace('"', '\"', $string).'"'; |
@@ -416,23 +416,23 @@ discard block |
||
| 416 | 416 | ); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - /** |
|
| 420 | - * Creates a renderer instance, which can be used to easily |
|
| 421 | - * create and convert commands to strings. |
|
| 422 | - * |
|
| 423 | - * @return Mailcode_Renderer |
|
| 424 | - */ |
|
| 419 | + /** |
|
| 420 | + * Creates a renderer instance, which can be used to easily |
|
| 421 | + * create and convert commands to strings. |
|
| 422 | + * |
|
| 423 | + * @return Mailcode_Renderer |
|
| 424 | + */ |
|
| 425 | 425 | public static function createRenderer() : Mailcode_Renderer |
| 426 | 426 | { |
| 427 | 427 | return new Mailcode_Renderer(); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - /** |
|
| 431 | - * Creates a printer instance, which works like the renderer, |
|
| 432 | - * but outputs the generated strings to standard output. |
|
| 433 | - * |
|
| 434 | - * @return Mailcode_Printer |
|
| 435 | - */ |
|
| 430 | + /** |
|
| 431 | + * Creates a printer instance, which works like the renderer, |
|
| 432 | + * but outputs the generated strings to standard output. |
|
| 433 | + * |
|
| 434 | + * @return Mailcode_Printer |
|
| 435 | + */ |
|
| 436 | 436 | public static function createPrinter() : Mailcode_Printer |
| 437 | 437 | { |
| 438 | 438 | return new Mailcode_Printer(); |
@@ -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(); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Commands_Command[] |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Commands_Command[] |
|
| 29 | + */ |
|
| 30 | 30 | protected $commands = array(); |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -34,17 +34,17 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | protected $errors = array(); |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var OperationResult|NULL |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var OperationResult|NULL |
|
| 39 | + */ |
|
| 40 | 40 | protected $validationResult; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Adds a command to the collection. |
|
| 44 | - * |
|
| 45 | - * @param Mailcode_Commands_Command $command |
|
| 46 | - * @return Mailcode_Collection |
|
| 47 | - */ |
|
| 42 | + /** |
|
| 43 | + * Adds a command to the collection. |
|
| 44 | + * |
|
| 45 | + * @param Mailcode_Commands_Command $command |
|
| 46 | + * @return Mailcode_Collection |
|
| 47 | + */ |
|
| 48 | 48 | public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection |
| 49 | 49 | { |
| 50 | 50 | $this->commands[] = $command; |
@@ -56,21 +56,21 @@ discard block |
||
| 56 | 56 | return $this; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Whether there are any commands in the collection. |
|
| 61 | - * |
|
| 62 | - * @return bool |
|
| 63 | - */ |
|
| 59 | + /** |
|
| 60 | + * Whether there are any commands in the collection. |
|
| 61 | + * |
|
| 62 | + * @return bool |
|
| 63 | + */ |
|
| 64 | 64 | public function hasCommands() : bool |
| 65 | 65 | { |
| 66 | 66 | return !empty($this->commands); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Counts the amount of commands in the collection. |
|
| 71 | - * |
|
| 72 | - * @return int |
|
| 73 | - */ |
|
| 69 | + /** |
|
| 70 | + * Counts the amount of commands in the collection. |
|
| 71 | + * |
|
| 72 | + * @return int |
|
| 73 | + */ |
|
| 74 | 74 | public function countCommands() : int |
| 75 | 75 | { |
| 76 | 76 | return count($this->commands); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | $this->errors[] = new Mailcode_Collection_Error_Command($command); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * @return Mailcode_Collection_Error[] |
|
| 95 | - */ |
|
| 93 | + /** |
|
| 94 | + * @return Mailcode_Collection_Error[] |
|
| 95 | + */ |
|
| 96 | 96 | public function getErrors() |
| 97 | 97 | { |
| 98 | 98 | $result = $this->getValidationResult(); |
@@ -134,25 +134,25 @@ discard block |
||
| 134 | 134 | return empty($errors); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Retrieves all commands that were detected, in the exact order |
|
| 139 | - * they were found. |
|
| 140 | - * |
|
| 141 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
| 142 | - */ |
|
| 137 | + /** |
|
| 138 | + * Retrieves all commands that were detected, in the exact order |
|
| 139 | + * they were found. |
|
| 140 | + * |
|
| 141 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
| 142 | + */ |
|
| 143 | 143 | public function getCommands() |
| 144 | 144 | { |
| 145 | - return $this->commands; |
|
| 145 | + return $this->commands; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Retrieves all unique commands by their matched |
|
| 150 | - * string hash: this ensures only commands that were |
|
| 151 | - * written the exact same way (including spacing) |
|
| 152 | - * are returned. |
|
| 153 | - * |
|
| 154 | - * @return \Mailcode\Mailcode_Commands_Command[] |
|
| 155 | - */ |
|
| 148 | + /** |
|
| 149 | + * Retrieves all unique commands by their matched |
|
| 150 | + * string hash: this ensures only commands that were |
|
| 151 | + * written the exact same way (including spacing) |
|
| 152 | + * are returned. |
|
| 153 | + * |
|
| 154 | + * @return \Mailcode\Mailcode_Commands_Command[] |
|
| 155 | + */ |
|
| 156 | 156 | public function getGroupedByHash() |
| 157 | 157 | { |
| 158 | 158 | $hashes = array(); |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | return array_values($hashes); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Adds several commands at once. |
|
| 175 | - * |
|
| 176 | - * @param Mailcode_Commands_Command[] $commands |
|
| 177 | - * @return Mailcode_Collection |
|
| 178 | - */ |
|
| 173 | + /** |
|
| 174 | + * Adds several commands at once. |
|
| 175 | + * |
|
| 176 | + * @param Mailcode_Commands_Command[] $commands |
|
| 177 | + * @return Mailcode_Collection |
|
| 178 | + */ |
|
| 179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
| 180 | 180 | { |
| 181 | 181 | foreach($commands as $command) |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | return false; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - /** |
|
| 238 | - * Retrieves only show variable commands in the collection, if any. |
|
| 239 | - * |
|
| 240 | - * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
| 241 | - */ |
|
| 237 | + /** |
|
| 238 | + * Retrieves only show variable commands in the collection, if any. |
|
| 239 | + * |
|
| 240 | + * @return \Mailcode\Mailcode_Commands_Command_ShowVariable[] |
|
| 241 | + */ |
|
| 242 | 242 | public function getShowVariableCommands() |
| 243 | 243 | { |
| 244 | 244 | $result = array(); |
@@ -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 | } |