@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $keyword = $info->getKeywordByIndex(1); |
| 63 | 63 | $container = $info->getVariableByIndex(2); |
| 64 | 64 | |
| 65 | - if($variable && $keyword && $container && $keyword->isForIn()) |
|
| 65 | + if ($variable && $keyword && $container && $keyword->isForIn()) |
|
| 66 | 66 | { |
| 67 | 67 | return; |
| 68 | 68 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName()); |
| 53 | 53 | |
| 54 | - if($this->command->hasType()) |
|
| 54 | + if ($this->command->hasType()) |
|
| 55 | 55 | { |
| 56 | 56 | $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType()); |
| 57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | protected function appendParams() : void |
| 64 | 64 | { |
| 65 | - if($this->command->hasParameters()) |
|
| 65 | + if ($this->command->hasParameters()) |
|
| 66 | 66 | { |
| 67 | 67 | $this->parts[] = ' '.$this->renderTag(array('params'), $this->command->getParamsString()); |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $parts = array(); |
| 79 | 79 | |
| 80 | - foreach($classes as $class) |
|
| 80 | + foreach ($classes as $class) |
|
| 81 | 81 | { |
| 82 | 82 | $parts[] = 'mailcode-'.$class; |
| 83 | 83 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $operand = $this->getOperandByIndex(1); |
| 49 | 49 | $value = $this->getTokenByIndex(2); |
| 50 | 50 | |
| 51 | - if($variable && $operand && $value && $operand->isAssignment()) |
|
| 51 | + if ($variable && $operand && $value && $operand->isAssignment()) |
|
| 52 | 52 | { |
| 53 | 53 | return true; |
| 54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $operand = $this->getOperandByIndex(1); |
| 68 | 68 | $value = $this->getTokenByIndex(2); |
| 69 | 69 | |
| 70 | - if($variable && $operand && $value && $operand->isComparator()) |
|
| 70 | + if ($variable && $operand && $value && $operand->isComparator()) |
|
| 71 | 71 | { |
| 72 | 72 | return true; |
| 73 | 73 | } |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $result = array(); |
| 86 | 86 | |
| 87 | - foreach($this->tokens as $token) |
|
| 87 | + foreach ($this->tokens as $token) |
|
| 88 | 88 | { |
| 89 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 89 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 90 | 90 | { |
| 91 | 91 | $result[] = $token->getVariable(); |
| 92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $token = $this->getTokenByIndex($index); |
| 101 | 101 | |
| 102 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 102 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 103 | 103 | { |
| 104 | 104 | return $token; |
| 105 | 105 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $token = $this->getTokenByIndex($index); |
| 113 | 113 | |
| 114 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 114 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 115 | 115 | { |
| 116 | 116 | return $token; |
| 117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $token = $this->getTokenByIndex($index); |
| 125 | 125 | |
| 126 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 126 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 127 | 127 | { |
| 128 | 128 | return $token; |
| 129 | 129 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
| 135 | 135 | { |
| 136 | - if(isset($this->tokens[$index])) |
|
| 136 | + if (isset($this->tokens[$index])) |
|
| 137 | 137 | { |
| 138 | 138 | return $this->tokens[$index]; |
| 139 | 139 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function getVariable() : Mailcode_Variables_Variable |
| 26 | 26 | { |
| 27 | - if($this->subject instanceof Mailcode_Variables_Variable) |
|
| 27 | + if ($this->subject instanceof Mailcode_Variables_Variable) |
|
| 28 | 28 | { |
| 29 | 29 | return $this->subject; |
| 30 | 30 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * @param string $matchedText |
| 41 | 41 | * @param mixed $subject |
| 42 | 42 | */ |
| 43 | - public function __construct(string $tokenID, string $matchedText, $subject=null) |
|
| 43 | + public function __construct(string $tokenID, string $matchedText, $subject = null) |
|
| 44 | 44 | { |
| 45 | 45 | $this->tokenID = $tokenID; |
| 46 | 46 | $this->matchedText = $matchedText; |
@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $result = array(); |
| 136 | 136 | |
| 137 | - foreach($this->tokensOrdered as $token) |
|
| 137 | + foreach ($this->tokensOrdered as $token) |
|
| 138 | 138 | { |
| 139 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
| 139 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown) |
|
| 140 | 140 | { |
| 141 | 141 | $result[] = $token; |
| 142 | 142 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $unknown = $this->getUnknown(); |
| 151 | 151 | |
| 152 | - if(!empty($unknown)) |
|
| 152 | + if (!empty($unknown)) |
|
| 153 | 153 | { |
| 154 | 154 | return array_shift($unknown); |
| 155 | 155 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $parts = array(); |
| 163 | 163 | |
| 164 | - foreach($this->tokensOrdered as $token) |
|
| 164 | + foreach ($this->tokensOrdered as $token) |
|
| 165 | 165 | { |
| 166 | 166 | $string = $token->getNormalized(); |
| 167 | 167 | |
| 168 | - if(!empty($string)) |
|
| 168 | + if (!empty($string)) |
|
| 169 | 169 | { |
| 170 | 170 | $parts[] = $string; |
| 171 | 171 | } |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $this->tokenized = trim($statement); |
| 180 | 180 | |
| 181 | - foreach($this->tokenCategories as $token) |
|
| 181 | + foreach ($this->tokenCategories as $token) |
|
| 182 | 182 | { |
| 183 | 183 | $method = 'tokenize_'.$token; |
| 184 | 184 | |
| 185 | - if(!method_exists($this, $method)) |
|
| 185 | + if (!method_exists($this, $method)) |
|
| 186 | 186 | { |
| 187 | 187 | throw new Mailcode_Exception( |
| 188 | 188 | 'Unknown statement token.', |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param string $matchedText |
| 207 | 207 | * @param mixed $subject |
| 208 | 208 | */ |
| 209 | - protected function registerToken(string $type, string $matchedText, $subject=null) : void |
|
| 209 | + protected function registerToken(string $type, string $matchedText, $subject = null) : void |
|
| 210 | 210 | { |
| 211 | 211 | $tokenID = $this->generateID(); |
| 212 | 212 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | protected function getTokenByID(string $tokenID) : ?Mailcode_Parser_Statement_Tokenizer_Token |
| 225 | 225 | { |
| 226 | - foreach($this->tokensTemporary as $token) |
|
| 226 | + foreach ($this->tokensTemporary as $token) |
|
| 227 | 227 | { |
| 228 | - if($token->getID() === $tokenID) |
|
| 228 | + if ($token->getID() === $tokenID) |
|
| 229 | 229 | { |
| 230 | 230 | return $token; |
| 231 | 231 | } |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | protected function tokenize_keywords() : void |
| 243 | 243 | { |
| 244 | - foreach($this->keywords as $keyword) |
|
| 244 | + foreach ($this->keywords as $keyword) |
|
| 245 | 245 | { |
| 246 | - if(strstr($this->tokenized, $keyword)) |
|
| 246 | + if (strstr($this->tokenized, $keyword)) |
|
| 247 | 247 | { |
| 248 | 248 | $this->registerToken('Keyword', $keyword); |
| 249 | 249 | } |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | // over that could not be tokenized. |
| 258 | 258 | $parts = \AppUtils\ConvertHelper::explodeTrim($this->delimiter, $this->tokenized); |
| 259 | 259 | |
| 260 | - foreach($parts as $part) |
|
| 260 | + foreach ($parts as $part) |
|
| 261 | 261 | { |
| 262 | 262 | $token = $this->getTokenByID($part); |
| 263 | 263 | |
| 264 | 264 | // if the entry is a token, simply add it. |
| 265 | - if($token) |
|
| 265 | + if ($token) |
|
| 266 | 266 | { |
| 267 | 267 | $this->tokensOrdered[] = $token; |
| 268 | 268 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $vars = Mailcode::create()->findVariables($this->tokenized)->getGroupedByHash(); |
| 280 | 280 | |
| 281 | - foreach($vars as $var) |
|
| 281 | + foreach ($vars as $var) |
|
| 282 | 282 | { |
| 283 | 283 | $this->registerToken('Variable', $var->getMatchedText(), $var); |
| 284 | 284 | } |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | protected function tokenize_operands() : void |
| 288 | 288 | { |
| 289 | - foreach($this->operands as $operand) |
|
| 289 | + foreach ($this->operands as $operand) |
|
| 290 | 290 | { |
| 291 | - if(strstr($this->tokenized, $operand)) |
|
| 291 | + if (strstr($this->tokenized, $operand)) |
|
| 292 | 292 | { |
| 293 | 293 | $this->registerToken('Operand', $operand); |
| 294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $matches = array(); |
| 301 | 301 | preg_match_all('/"(.*)"/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER); |
| 302 | 302 | |
| 303 | - foreach($matches[0] as $match) |
|
| 303 | + foreach ($matches[0] as $match) |
|
| 304 | 304 | { |
| 305 | 305 | $this->registerToken('StringLiteral', $match); |
| 306 | 306 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $matches = array(); |
| 312 | 312 | preg_match_all('/-*[0-9]+\s*[.,]\s*[0-9]+|-*[0-9]+/sx', $this->tokenized, $matches, PREG_PATTERN_ORDER); |
| 313 | 313 | |
| 314 | - foreach($matches[0] as $match) |
|
| 314 | + foreach ($matches[0] as $match) |
|
| 315 | 315 | { |
| 316 | 316 | $this->registerToken('Number', $match); |
| 317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | { |
| 329 | 329 | static $alphas; |
| 330 | 330 | |
| 331 | - if(!isset($alphas)) |
|
| 331 | + if (!isset($alphas)) |
|
| 332 | 332 | { |
| 333 | 333 | $alphas = range('A', 'Z'); |
| 334 | 334 | } |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | $result = ''; |
| 339 | 339 | |
| 340 | - for($i=0; $i < $amount; $i++) |
|
| 340 | + for ($i = 0; $i < $amount; $i++) |
|
| 341 | 341 | { |
| 342 | 342 | $result .= $alphas[array_rand($alphas)]; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(!in_array($result, self::$ids)) |
|
| 345 | + if (!in_array($result, self::$ids)) |
|
| 346 | 346 | { |
| 347 | 347 | self::$ids[] = $result; |
| 348 | 348 | return $result; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @param \Exception|NULL $previous |
| 33 | 33 | * @param Mailcode_Commands_Command|NULL $command |
| 34 | 34 | */ |
| 35 | - public function __construct(string $message, $details=null, $code=null, $previous=null, Mailcode_Commands_Command $command=null) |
|
| 35 | + public function __construct(string $message, $details = null, $code = null, $previous = null, Mailcode_Commands_Command $command = null) |
|
| 36 | 36 | { |
| 37 | 37 | parent::__construct($message, $details, $code, $previous); |
| 38 | 38 | |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
| 63 | 63 | */ |
| 64 | - public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
|
| 64 | + public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable |
|
| 65 | 65 | { |
| 66 | 66 | $variableName = self::_filterVariableName($variableName); |
| 67 | 67 | |
| 68 | - if($quoteValue) |
|
| 68 | + if ($quoteValue) |
|
| 69 | 69 | { |
| 70 | 70 | $value = self::_quoteString($value); |
| 71 | 71 | } |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | return $cmd; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - protected static function _buildIf(string $cmd, string $condition, string $type='') : Mailcode_Commands_Command |
|
| 141 | + protected static function _buildIf(string $cmd, string $condition, string $type = '') : Mailcode_Commands_Command |
|
| 142 | 142 | { |
| 143 | 143 | $stringType = $type; |
| 144 | 144 | |
| 145 | - if(!empty($type)) |
|
| 145 | + if (!empty($type)) |
|
| 146 | 146 | { |
| 147 | 147 | $stringType = ' '.$type; |
| 148 | 148 | } |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | return $cmd; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command |
|
| 168 | + protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command |
|
| 169 | 169 | { |
| 170 | - if($quoteValue) |
|
| 170 | + if ($quoteValue) |
|
| 171 | 171 | { |
| 172 | 172 | $value = self::_quoteString($value); |
| 173 | 173 | } |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | return self::_buildIf($cmd, $condition, 'variable'); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
| 185 | + public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
| 186 | 186 | { |
| 187 | 187 | $cmd = self::_buildIf('If', $condition, $type); |
| 188 | 188 | |
| 189 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 189 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 190 | 190 | { |
| 191 | 191 | return $cmd; |
| 192 | 192 | } |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | throw self::_exceptionUnexpectedType($cmd); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If |
|
| 197 | + public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If |
|
| 198 | 198 | { |
| 199 | 199 | $cmd = self::_buildIfVar('If', $variable, $operand, $value, $quoteValue); |
| 200 | 200 | |
| 201 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 201 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 202 | 202 | { |
| 203 | 203 | return $cmd; |
| 204 | 204 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $cmd = self::_buildIfVar('If', $variable, $operand, $value, true); |
| 212 | 212 | |
| 213 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 213 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 214 | 214 | { |
| 215 | 215 | return $cmd; |
| 216 | 216 | } |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | throw self::_exceptionUnexpectedType($cmd); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If |
|
| 221 | + public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If |
|
| 222 | 222 | { |
| 223 | 223 | $cmd = self::_buildIfVar('If', $variable, '==', $value, $quoteValue); |
| 224 | 224 | |
| 225 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 225 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 226 | 226 | { |
| 227 | 227 | return $cmd; |
| 228 | 228 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $cmd = self::_buildIfVar('If', $variable, '==', $value, true); |
| 236 | 236 | |
| 237 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 237 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 238 | 238 | { |
| 239 | 239 | return $cmd; |
| 240 | 240 | } |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | throw self::_exceptionUnexpectedType($cmd); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If |
|
| 245 | + public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If |
|
| 246 | 246 | { |
| 247 | 247 | $cmd = self::_buildIfVar('If', $variable, '!=', $value, $quoteValue); |
| 248 | 248 | |
| 249 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 249 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 250 | 250 | { |
| 251 | 251 | return $cmd; |
| 252 | 252 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $cmd = self::_buildIfVar('If', $variable, '!=', $value, true); |
| 260 | 260 | |
| 261 | - if($cmd instanceof Mailcode_Commands_Command_If) |
|
| 261 | + if ($cmd instanceof Mailcode_Commands_Command_If) |
|
| 262 | 262 | { |
| 263 | 263 | return $cmd; |
| 264 | 264 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | throw self::_exceptionUnexpectedType($cmd); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
| 269 | + public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
| 270 | 270 | { |
| 271 | 271 | $cmd = self::_buildIf('ElseIf', $condition, $type); |
| 272 | 272 | |
| 273 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 273 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 274 | 274 | { |
| 275 | 275 | return $cmd; |
| 276 | 276 | } |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | throw self::_exceptionUnexpectedType($cmd); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf |
|
| 281 | + public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf |
|
| 282 | 282 | { |
| 283 | 283 | $cmd = self::_buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue); |
| 284 | 284 | |
| 285 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 285 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 286 | 286 | { |
| 287 | 287 | return $cmd; |
| 288 | 288 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $cmd = self::_buildIfVar('ElseIf', $variable, $operand, $value, true); |
| 296 | 296 | |
| 297 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 297 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 298 | 298 | { |
| 299 | 299 | return $cmd; |
| 300 | 300 | } |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | throw self::_exceptionUnexpectedType($cmd); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf |
|
| 305 | + public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf |
|
| 306 | 306 | { |
| 307 | 307 | $cmd = self::_buildIfVar('ElseIf', $variable, '==', $value, $quoteValue); |
| 308 | 308 | |
| 309 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 309 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 310 | 310 | { |
| 311 | 311 | return $cmd; |
| 312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | { |
| 319 | 319 | $cmd = self::_buildIfVar('ElseIf', $variable, '==', $value, true); |
| 320 | 320 | |
| 321 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 321 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 322 | 322 | { |
| 323 | 323 | return $cmd; |
| 324 | 324 | } |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | throw self::_exceptionUnexpectedType($cmd); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf |
|
| 329 | + public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf |
|
| 330 | 330 | { |
| 331 | 331 | $cmd = self::_buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue); |
| 332 | 332 | |
| 333 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 333 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 334 | 334 | { |
| 335 | 335 | return $cmd; |
| 336 | 336 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | { |
| 343 | 343 | $cmd = self::_buildIfVar('ElseIf', $variable, '!=', $value, true); |
| 344 | 344 | |
| 345 | - if($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 345 | + if ($cmd instanceof Mailcode_Commands_Command_ElseIf) |
|
| 346 | 346 | { |
| 347 | 347 | return $cmd; |
| 348 | 348 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | protected static function _checkCommand(Mailcode_Commands_Command $command) : void |
| 370 | 370 | { |
| 371 | - if($command->isValid()) |
|
| 371 | + if ($command->isValid()) |
|
| 372 | 372 | { |
| 373 | 373 | return; |
| 374 | 374 | } |
@@ -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 = $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(); |