@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public static function getInstance() : Mailcode_Date_FormatInfo |
| 60 | 60 | { |
| 61 | - if(!isset(self::$instance)) |
|
| 61 | + if (!isset(self::$instance)) |
|
| 62 | 62 | { |
| 63 | 63 | self::$instance = new Mailcode_Date_FormatInfo(); |
| 64 | 64 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | array(self::CHARTYPE_PUNCTUATION, ' ', t('Space')) |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | - foreach($chars as $def) |
|
| 93 | + foreach ($chars as $def) |
|
| 94 | 94 | { |
| 95 | 95 | $char = new Mailcode_Date_FormatInfo_Character( |
| 96 | 96 | $def[0], |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $trimmed = trim($formatString); |
| 131 | 131 | |
| 132 | - if(empty($trimmed)) |
|
| 132 | + if (empty($trimmed)) |
|
| 133 | 133 | { |
| 134 | 134 | $result->makeError( |
| 135 | 135 | t('Empty date format.'), |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | $chars = ConvertHelper::string2array($formatString); |
| 143 | 143 | $total = count($chars); |
| 144 | 144 | |
| 145 | - for($i=0; $i < $total; $i++) |
|
| 145 | + for ($i = 0; $i < $total; $i++) |
|
| 146 | 146 | { |
| 147 | 147 | $char = $chars[$i]; |
| 148 | 148 | |
| 149 | - if(!in_array($char, $this->allowedChars)) |
|
| 149 | + if (!in_array($char, $this->allowedChars)) |
|
| 150 | 150 | { |
| 151 | 151 | $result->makeError( |
| 152 | 152 | t('Invalid character in date format:').' '. |
| 153 | - t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i+1), |
|
| 153 | + t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1), |
|
| 154 | 154 | self::VALIDATION_INVALID_FORMAT_CHARACTER |
| 155 | 155 | ); |
| 156 | 156 | |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $grouped = array(); |
| 184 | 184 | |
| 185 | - foreach($this->formatChars as $char) |
|
| 185 | + foreach ($this->formatChars as $char) |
|
| 186 | 186 | { |
| 187 | 187 | $type = $char->getTypeLabel(); |
| 188 | 188 | |
| 189 | - if(!isset($grouped[$type])) |
|
| 189 | + if (!isset($grouped[$type])) |
|
| 190 | 190 | { |
| 191 | 191 | $grouped[$type] = array(); |
| 192 | 192 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $groups = array_keys($grouped); |
| 198 | 198 | |
| 199 | - foreach($groups as $group) |
|
| 199 | + foreach ($groups as $group) |
|
| 200 | 200 | { |
| 201 | 201 | usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) |
| 202 | 202 | { |
@@ -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 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $token = $this->getTokenByIndex($index); |
| 109 | 109 | |
| 110 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 110 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 111 | 111 | { |
| 112 | 112 | return $token; |
| 113 | 113 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $token = $this->getTokenByIndex($index); |
| 129 | 129 | |
| 130 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 130 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 131 | 131 | { |
| 132 | 132 | return $token; |
| 133 | 133 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $token = $this->getTokenByIndex($index); |
| 149 | 149 | |
| 150 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 150 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 151 | 151 | { |
| 152 | 152 | return $token; |
| 153 | 153 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $token = $this->getTokenByIndex($index); |
| 169 | 169 | |
| 170 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 170 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 171 | 171 | { |
| 172 | 172 | return $token; |
| 173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function getTokenByIndex(int $index) : ?Mailcode_Parser_Statement_Tokenizer_Token |
| 187 | 187 | { |
| 188 | - if(isset($this->tokens[$index])) |
|
| 188 | + if (isset($this->tokens[$index])) |
|
| 189 | 189 | { |
| 190 | 190 | return $this->tokens[$index]; |
| 191 | 191 | } |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | { |
| 207 | 207 | $result = array(); |
| 208 | 208 | |
| 209 | - foreach($this->tokens as $token) |
|
| 209 | + foreach ($this->tokens as $token) |
|
| 210 | 210 | { |
| 211 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 211 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 212 | 212 | { |
| 213 | 213 | $result[] = $token; |
| 214 | 214 | } |
@@ -56,18 +56,18 @@ |
||
| 56 | 56 | $token = $this->params->getInfo()->getTokenByIndex(1); |
| 57 | 57 | |
| 58 | 58 | // no format specified? Use the default one. |
| 59 | - if($token === null) |
|
| 59 | + if ($token === null) |
|
| 60 | 60 | { |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 64 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral) |
|
| 65 | 65 | { |
| 66 | 66 | $format = $token->getText(); |
| 67 | 67 | |
| 68 | 68 | $result = $this->formatInfo->validateFormat($format); |
| 69 | 69 | |
| 70 | - if($result->isValid()) |
|
| 70 | + if ($result->isValid()) |
|
| 71 | 71 | { |
| 72 | 72 | $this->formatString = $format; |
| 73 | 73 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | self::_checkCommand($cmd); |
| 50 | 50 | |
| 51 | - if($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
| 51 | + if ($cmd instanceof Mailcode_Commands_Command_ShowVariable) |
|
| 52 | 52 | { |
| 53 | 53 | return $cmd; |
| 54 | 54 | } |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | * @param string $formatString A date format string, or empty string for default. |
| 65 | 65 | * @return Mailcode_Commands_Command_ShowDate |
| 66 | 66 | */ |
| 67 | - public static function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
|
| 67 | + public static function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate |
|
| 68 | 68 | { |
| 69 | 69 | $variableName = self::_filterVariableName($variableName); |
| 70 | 70 | |
| 71 | 71 | $format = ''; |
| 72 | - if(!empty($formatString)) |
|
| 72 | + if (!empty($formatString)) |
|
| 73 | 73 | { |
| 74 | 74 | $format = sprintf( |
| 75 | 75 | ' "%s"', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | self::_checkCommand($cmd); |
| 92 | 92 | |
| 93 | - if($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
| 93 | + if ($cmd instanceof Mailcode_Commands_Command_ShowDate) |
|
| 94 | 94 | { |
| 95 | 95 | return $cmd; |
| 96 | 96 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | self::_checkCommand($cmd); |
| 120 | 120 | |
| 121 | - if($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
| 121 | + if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
| 122 | 122 | { |
| 123 | 123 | return $cmd; |
| 124 | 124 | } |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
| 139 | 139 | */ |
| 140 | - public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
|
| 140 | + public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable |
|
| 141 | 141 | { |
| 142 | 142 | $variableName = self::_filterVariableName($variableName); |
| 143 | 143 | |
| 144 | - if($quoteValue) |
|
| 144 | + if ($quoteValue) |
|
| 145 | 145 | { |
| 146 | 146 | $value = self::_quoteString($value); |
| 147 | 147 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | self::_checkCommand($cmd); |
| 159 | 159 | |
| 160 | - if($cmd instanceof Mailcode_Commands_Command_SetVariable) |
|
| 160 | + if ($cmd instanceof Mailcode_Commands_Command_SetVariable) |
|
| 161 | 161 | { |
| 162 | 162 | return $cmd; |
| 163 | 163 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | self::_checkCommand($cmd); |
| 194 | 194 | |
| 195 | - if($cmd instanceof Mailcode_Commands_Command_Comment) |
|
| 195 | + if ($cmd instanceof Mailcode_Commands_Command_Comment) |
|
| 196 | 196 | { |
| 197 | 197 | return $cmd; |
| 198 | 198 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | self::_checkCommand($cmd); |
| 213 | 213 | |
| 214 | - if($cmd instanceof Mailcode_Commands_Command_Else) |
|
| 214 | + if ($cmd instanceof Mailcode_Commands_Command_Else) |
|
| 215 | 215 | { |
| 216 | 216 | return $cmd; |
| 217 | 217 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | self::_checkCommand($cmd); |
| 232 | 232 | |
| 233 | - if($cmd instanceof Mailcode_Commands_Command_End) |
|
| 233 | + if ($cmd instanceof Mailcode_Commands_Command_End) |
|
| 234 | 234 | { |
| 235 | 235 | return $cmd; |
| 236 | 236 | } |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | throw self::_exceptionUnexpectedType('End', $cmd); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - protected static function _buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase |
|
| 241 | + protected static function _buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase |
|
| 242 | 242 | { |
| 243 | 243 | $stringType = $type; |
| 244 | 244 | |
| 245 | - if(!empty($type)) |
|
| 245 | + if (!empty($type)) |
|
| 246 | 246 | { |
| 247 | 247 | $stringType = ' '.$type; |
| 248 | 248 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | self::_checkCommand($command); |
| 263 | 263 | |
| 264 | - if($command instanceof Mailcode_Commands_IfBase) |
|
| 264 | + if ($command instanceof Mailcode_Commands_IfBase) |
|
| 265 | 265 | { |
| 266 | 266 | return $command; |
| 267 | 267 | } |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | throw self::_exceptionUnexpectedType('IfBase', $command); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - protected static function _buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_IfBase |
|
| 272 | + protected static function _buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_IfBase |
|
| 273 | 273 | { |
| 274 | - if($quoteValue) |
|
| 274 | + if ($quoteValue) |
|
| 275 | 275 | { |
| 276 | 276 | $value = self::_quoteString($value); |
| 277 | 277 | } |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | return self::_buildIf($ifType, $condition, 'variable'); |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If |
|
| 289 | + public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If |
|
| 290 | 290 | { |
| 291 | 291 | $command = self::_buildIf('If', $condition, $type); |
| 292 | 292 | |
| 293 | - if($command instanceof Mailcode_Commands_Command_If) |
|
| 293 | + if ($command instanceof Mailcode_Commands_Command_If) |
|
| 294 | 294 | { |
| 295 | 295 | return $command; |
| 296 | 296 | } |
@@ -298,11 +298,11 @@ discard block |
||
| 298 | 298 | throw self::_exceptionUnexpectedType('If', $command); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 301 | + public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 302 | 302 | { |
| 303 | 303 | $command = self::_buildIfVar('If', $variable, $operand, $value, $quoteValue); |
| 304 | 304 | |
| 305 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 305 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 306 | 306 | { |
| 307 | 307 | return $command; |
| 308 | 308 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | { |
| 315 | 315 | $command = self::_buildIfVar('If', $variable, $operand, $value, true); |
| 316 | 316 | |
| 317 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 317 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 318 | 318 | { |
| 319 | 319 | return $command; |
| 320 | 320 | } |
@@ -322,11 +322,11 @@ discard block |
||
| 322 | 322 | throw self::_exceptionUnexpectedType('IfVarString', $command); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 325 | + public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 326 | 326 | { |
| 327 | 327 | $command = self::_buildIfVar('If', $variable, '==', $value, $quoteValue); |
| 328 | 328 | |
| 329 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 329 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 330 | 330 | { |
| 331 | 331 | return $command; |
| 332 | 332 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | { |
| 339 | 339 | $command = self::_buildIfVar('If', $variable, '==', $value, true); |
| 340 | 340 | |
| 341 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 341 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 342 | 342 | { |
| 343 | 343 | return $command; |
| 344 | 344 | } |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | throw self::_exceptionUnexpectedType('IfarEqualsString', $command); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable |
|
| 349 | + public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable |
|
| 350 | 350 | { |
| 351 | 351 | $command = self::_buildIfVar('If', $variable, '!=', $value, $quoteValue); |
| 352 | 352 | |
| 353 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 353 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 354 | 354 | { |
| 355 | 355 | return $command; |
| 356 | 356 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | { |
| 363 | 363 | $command = self::_buildIfVar('If', $variable, '!=', $value, true); |
| 364 | 364 | |
| 365 | - if($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 365 | + if ($command instanceof Mailcode_Commands_Command_If_Variable) |
|
| 366 | 366 | { |
| 367 | 367 | return $command; |
| 368 | 368 | } |
@@ -370,11 +370,11 @@ discard block |
||
| 370 | 370 | throw self::_exceptionUnexpectedType('IfVarNotEqualsString', $command); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf |
|
| 373 | + public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf |
|
| 374 | 374 | { |
| 375 | 375 | $command = self::_buildIf('ElseIf', $condition, $type); |
| 376 | 376 | |
| 377 | - if($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 377 | + if ($command instanceof Mailcode_Commands_Command_ElseIf) |
|
| 378 | 378 | { |
| 379 | 379 | return $command; |
| 380 | 380 | } |
@@ -382,11 +382,11 @@ discard block |
||
| 382 | 382 | throw self::_exceptionUnexpectedType('ElseIf', $command); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 385 | + public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 386 | 386 | { |
| 387 | 387 | $command = self::_buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue); |
| 388 | 388 | |
| 389 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 389 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 390 | 390 | { |
| 391 | 391 | return $command; |
| 392 | 392 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | { |
| 399 | 399 | $command = self::_buildIfVar('ElseIf', $variable, $operand, $value, true); |
| 400 | 400 | |
| 401 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 401 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 402 | 402 | { |
| 403 | 403 | return $command; |
| 404 | 404 | } |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | throw self::_exceptionUnexpectedType('ElseIfVarString', $command); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 409 | + public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 410 | 410 | { |
| 411 | 411 | $command = self::_buildIfVar('ElseIf', $variable, '==', $value, $quoteValue); |
| 412 | 412 | |
| 413 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 413 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 414 | 414 | { |
| 415 | 415 | return $command; |
| 416 | 416 | } |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | { |
| 423 | 423 | $command = self::_buildIfVar('ElseIf', $variable, '==', $value, true); |
| 424 | 424 | |
| 425 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 425 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 426 | 426 | { |
| 427 | 427 | return $command; |
| 428 | 428 | } |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | throw self::_exceptionUnexpectedType('ElseIfVarEqualsString', $command); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 433 | + public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable |
|
| 434 | 434 | { |
| 435 | 435 | $command = self::_buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue); |
| 436 | 436 | |
| 437 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 437 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 438 | 438 | { |
| 439 | 439 | return $command; |
| 440 | 440 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | { |
| 447 | 447 | $command = self::_buildIfVar('ElseIf', $variable, '!=', $value, true); |
| 448 | 448 | |
| 449 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 449 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable) |
|
| 450 | 450 | { |
| 451 | 451 | return $command; |
| 452 | 452 | } |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | throw self::_exceptionUnexpectedType('ElseIfVarNotEqualsString', $command); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - public static function ifContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
|
| 457 | + public static function ifContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains |
|
| 458 | 458 | { |
| 459 | 459 | $command = self::_buildIfContains('If', $variable, $search, $caseInsensitive); |
| 460 | 460 | |
| 461 | - if($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 461 | + if ($command instanceof Mailcode_Commands_Command_If_Contains) |
|
| 462 | 462 | { |
| 463 | 463 | return $command; |
| 464 | 464 | } |
@@ -466,11 +466,11 @@ discard block |
||
| 466 | 466 | throw self::_exceptionUnexpectedType('ElseIfContains', $command); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - public static function elseIfContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
|
| 469 | + public static function elseIfContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains |
|
| 470 | 470 | { |
| 471 | 471 | $command = self::_buildIfContains('ElseIf', $variable, $search, $caseInsensitive); |
| 472 | 472 | |
| 473 | - if($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 473 | + if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains) |
|
| 474 | 474 | { |
| 475 | 475 | return $command; |
| 476 | 476 | } |
@@ -478,11 +478,11 @@ discard block |
||
| 478 | 478 | throw self::_exceptionUnexpectedType('ElseIfContains', $command); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - protected static function _buildIfContains(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
|
| 481 | + protected static function _buildIfContains(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase |
|
| 482 | 482 | { |
| 483 | 483 | $keyword = ' '; |
| 484 | 484 | |
| 485 | - if($caseInsensitive) |
|
| 485 | + if ($caseInsensitive) |
|
| 486 | 486 | { |
| 487 | 487 | $keyword = ' insensitive: '; |
| 488 | 488 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | protected static function _checkCommand(Mailcode_Commands_Command $command) : void |
| 519 | 519 | { |
| 520 | - if($command->isValid()) |
|
| 520 | + if ($command->isValid()) |
|
| 521 | 521 | { |
| 522 | 522 | return; |
| 523 | 523 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function getInfo() : Mailcode_Parser_Statement_Info |
| 77 | 77 | { |
| 78 | - if($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 78 | + if ($this->info instanceof Mailcode_Parser_Statement_Info) |
|
| 79 | 79 | { |
| 80 | 80 | return $this->info; |
| 81 | 81 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | protected function validate() : void |
| 89 | 89 | { |
| 90 | - if(!$this->tokenizer->hasTokens()) |
|
| 90 | + if (!$this->tokenizer->hasTokens()) |
|
| 91 | 91 | { |
| 92 | 92 | $this->result->makeError( |
| 93 | 93 | t('Empty statement'), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $unknown = $this->tokenizer->getFirstUnknown(); |
| 101 | 101 | |
| 102 | - if($unknown) |
|
| 102 | + if ($unknown) |
|
| 103 | 103 | { |
| 104 | 104 | $this->result->makeError( |
| 105 | 105 | t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')', |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $this->validate(); |
| 71 | 71 | |
| 72 | - if($this->variable instanceof Mailcode_Variables_Variable) |
|
| 72 | + if ($this->variable instanceof Mailcode_Variables_Variable) |
|
| 73 | 73 | { |
| 74 | 74 | return $this->variable; |
| 75 | 75 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $vars = $this->getVariables()->getGroupedByName(); |
| 101 | 101 | $amount = count($vars); |
| 102 | 102 | |
| 103 | - if($amount === 1) |
|
| 103 | + if ($amount === 1) |
|
| 104 | 104 | { |
| 105 | 105 | $this->variable = array_pop($vars); |
| 106 | 106 | return; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $this->validate(); |
| 67 | 67 | |
| 68 | - if($this->variable instanceof Mailcode_Variables_Variable) |
|
| 68 | + if ($this->variable instanceof Mailcode_Variables_Variable) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->variable; |
| 71 | 71 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $var = $info->getVariableByIndex(0); |
| 97 | 97 | |
| 98 | - if($var) |
|
| 98 | + if ($var) |
|
| 99 | 99 | { |
| 100 | 100 | $this->variable = $var->getVariable(); |
| 101 | 101 | return; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | static $ids = array(); |
| 48 | 48 | |
| 49 | - if(empty($ids)) { |
|
| 49 | + if (empty($ids)) { |
|
| 50 | 50 | $ids = \AppUtils\FileHelper::createFileFinder(__DIR__.'/Commands/Command') |
| 51 | 51 | ->getPHPClassNames(); |
| 52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function getAll() |
| 65 | 65 | { |
| 66 | - if(!empty($this->commands)) { |
|
| 66 | + if (!empty($this->commands)) { |
|
| 67 | 67 | return $this->commands; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $result = array(); |
| 73 | 73 | |
| 74 | - foreach($ids as $id) |
|
| 74 | + foreach ($ids as $id) |
|
| 75 | 75 | { |
| 76 | 76 | $result[] = $this->getDummyCommand($id); |
| 77 | 77 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | static $instances = array(); |
| 98 | 98 | |
| 99 | - if(!isset($instances[$id])) |
|
| 99 | + if (!isset($instances[$id])) |
|
| 100 | 100 | { |
| 101 | 101 | $instances[$id] = $this->createCommand($id, '__dummy', '', ''); |
| 102 | 102 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $items = $this->getAll(); |
| 119 | 119 | |
| 120 | - foreach($items as $item) |
|
| 120 | + foreach ($items as $item) |
|
| 121 | 121 | { |
| 122 | - if($item->getName() === $name) { |
|
| 122 | + if ($item->getName() === $name) { |
|
| 123 | 123 | return $item->getID(); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $items = $this->getAll(); |
| 153 | 153 | |
| 154 | - foreach($items as $item) |
|
| 154 | + foreach ($items as $item) |
|
| 155 | 155 | { |
| 156 | - if($item->getName() === $name) { |
|
| 156 | + if ($item->getName() === $name) { |
|
| 157 | 157 | return true; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $class = $this->resolveClassName($id, $type); |
| 167 | 167 | |
| 168 | - if(!class_exists($class)) |
|
| 168 | + if (!class_exists($class)) |
|
| 169 | 169 | { |
| 170 | 170 | throw new Mailcode_Exception( |
| 171 | 171 | 'No such command', |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $dummy = $this->getDummyCommand($id); |
| 189 | 189 | |
| 190 | - if($dummy->supportsType()) |
|
| 190 | + if ($dummy->supportsType()) |
|
| 191 | 191 | { |
| 192 | - if(empty($type)) |
|
| 192 | + if (empty($type)) |
|
| 193 | 193 | { |
| 194 | 194 | $type = $dummy->getDefaultType(); |
| 195 | 195 | } |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | private function getDummyCommand(string $id) : Mailcode_Commands_Command |
| 211 | 211 | { |
| 212 | - if(!isset(self::$dummyCommands[$id])) |
|
| 212 | + if (!isset(self::$dummyCommands[$id])) |
|
| 213 | 213 | { |
| 214 | 214 | $class = 'Mailcode\Mailcode_Commands_Command_'.$id; |
| 215 | 215 | self::$dummyCommands[$id] = new $class('__dummy'); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if(self::$dummyCommands[$id] instanceof Mailcode_Commands_Command) |
|
| 218 | + if (self::$dummyCommands[$id] instanceof Mailcode_Commands_Command) |
|
| 219 | 219 | { |
| 220 | 220 | return self::$dummyCommands[$id]; |
| 221 | 221 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $var = $info->getVariableByIndex(0); |
| 55 | 55 | |
| 56 | - if($var !== null) |
|
| 56 | + if ($var !== null) |
|
| 57 | 57 | { |
| 58 | 58 | $this->variableToken = $var; |
| 59 | 59 | return; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $operand = $info->getOperandByIndex(1); |
| 73 | 73 | |
| 74 | - if($operand === null) |
|
| 74 | + if ($operand === null) |
|
| 75 | 75 | { |
| 76 | 76 | $this->validationResult->makeError( |
| 77 | 77 | t('No operand sign after the variable name.'), |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(!$operand->isComparator()) |
|
| 84 | + if (!$operand->isComparator()) |
|
| 85 | 85 | { |
| 86 | 86 | $this->validationResult->makeError( |
| 87 | 87 | t('The operand sign is not a comparison operand.'), |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $token = $info->getTokenByIndex(2); |
| 102 | 102 | |
| 103 | - if($token === null) |
|
| 103 | + if ($token === null) |
|
| 104 | 104 | { |
| 105 | 105 | $this->validationResult->makeError( |
| 106 | 106 | t('Nothing found after the comparison operand.'), |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value) |
|
| 113 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value) |
|
| 114 | 114 | { |
| 115 | 115 | $this->valueToken = $token; |
| 116 | 116 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function getVariable() : Mailcode_Variables_Variable |
| 132 | 132 | { |
| 133 | - if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 133 | + if ($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable) |
|
| 134 | 134 | { |
| 135 | 135 | return $this->variableToken->getVariable(); |
| 136 | 136 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function getComparator() : string |
| 152 | 152 | { |
| 153 | - if($this->comparisonToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 153 | + if ($this->comparisonToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand) |
|
| 154 | 154 | { |
| 155 | 155 | return $this->comparisonToken->getOperand(); |
| 156 | 156 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function getValue() : string |
| 170 | 170 | { |
| 171 | - if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value) |
|
| 171 | + if ($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value) |
|
| 172 | 172 | { |
| 173 | 173 | return $this->valueToken->getValue(); |
| 174 | 174 | } |