@@ -50,8 +50,7 @@ |
||
| 50 | 50 | if(!empty($matches[3][$idx])) |
| 51 | 51 | { |
| 52 | 52 | $this->addSingle($matches[3][$idx], $matchedText); |
| 53 | - } |
|
| 54 | - else |
|
| 53 | + } else |
|
| 55 | 54 | { |
| 56 | 55 | $this->addPathed($matches[1][$idx], $matches[2][$idx], $matchedText); |
| 57 | 56 | } |
@@ -62,7 +62,9 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function if(string $condition, string $type='') : string |
| 64 | 64 | { |
| 65 | - return $this->command2string(Mailcode_Factory::if($condition, $type)); |
|
| 65 | + return $this->command2string(Mailcode_Factory::if($condition, $type) { |
|
| 66 | + ); |
|
| 67 | + } |
|
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | public function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
@@ -97,7 +99,9 @@ discard block |
||
| 97 | 99 | |
| 98 | 100 | public function elseIf(string $condition, string $type='') : string |
| 99 | 101 | { |
| 100 | - return $this->command2string(Mailcode_Factory::elseIf($condition, $type)); |
|
| 102 | + return $this->command2string(Mailcode_Factory::elseIf($condition, $type) { |
|
| 103 | + ); |
|
| 104 | + } |
|
| 101 | 105 | } |
| 102 | 106 | |
| 103 | 107 | public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
@@ -130,10 +134,12 @@ discard block |
||
| 130 | 134 | return $this->command2string(Mailcode_Factory::elseIfVarNotEqualsString($variable, $value)); |
| 131 | 135 | } |
| 132 | 136 | |
| 133 | - public function else() : string |
|
| 137 | + public function else { |
|
| 138 | + () : string |
|
| 134 | 139 | { |
| 135 | 140 | return $this->command2string(Mailcode_Factory::else()); |
| 136 | 141 | } |
| 142 | + } |
|
| 137 | 143 | |
| 138 | 144 | public function end() : string |
| 139 | 145 | { |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class Mailcode_Factory_CommandSets_IfBase extends Mailcode_Factory_CommandSets_Set |
| 22 | 22 | { |
| 23 | - public function else() : Mailcode_Commands_Command_Else |
|
| 23 | + public function else { |
|
| 24 | + () : Mailcode_Commands_Command_Else |
|
| 24 | 25 | { |
| 25 | 26 | $cmd = Mailcode::create()->getCommands()->createCommand( |
| 26 | 27 | 'Else', |
@@ -28,6 +29,7 @@ discard block |
||
| 28 | 29 | '', |
| 29 | 30 | '{else}' |
| 30 | 31 | ); |
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $this->instantiator->checkCommand($cmd); |
| 33 | 35 | |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | if($keyCommand instanceof Mailcode_Commands_IfBase) |
| 41 | 41 | { |
| 42 | 42 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 43 | - } |
|
| 44 | - else |
|
| 43 | + } else |
|
| 45 | 44 | { |
| 46 | 45 | throw new Mailcode_Exception( |
| 47 | 46 | 'Keyword command type does not match expected base class.', |
@@ -65,10 +65,12 @@ |
||
| 65 | 65 | Mailcode_Factory::comment('Some comments here'), |
| 66 | 66 | Mailcode_Factory::showSnippet('snippet_name'), |
| 67 | 67 | Mailcode_Factory::showDate('DATE.VARIABLE'), |
| 68 | - Mailcode_Factory::if('1 + 1 == 2'), |
|
| 68 | + Mailcode_Factory::if('1 + 1 == 2') { |
|
| 69 | + , |
|
| 69 | 70 | Mailcode_Factory::ifContains('CUSTOMER.NAME', 'John'), |
| 70 | 71 | Mailcode_Factory::ifVarEquals('NUMBER', 124), |
| 71 | 72 | ); |
| 73 | + } |
|
| 72 | 74 | |
| 73 | 75 | $and = Mailcode_Factory::elseIfVarEqualsString('STRINGVAR', 'John'); |
| 74 | 76 | $and->getLogicKeywords()->appendOR('$STRINGVAR == "Steve"', "variable"); |
@@ -76,8 +76,7 @@ |
||
| 76 | 76 | if($val->isValid()) |
| 77 | 77 | { |
| 78 | 78 | $this->variableToken = $val->getToken(); |
| 79 | - } |
|
| 80 | - else |
|
| 79 | + } else |
|
| 81 | 80 | { |
| 82 | 81 | $this->validationResult->makeError( |
| 83 | 82 | 'The first parameter must be a variable name.', |
@@ -36,8 +36,7 @@ |
||
| 36 | 36 | if($val->isValid()) |
| 37 | 37 | { |
| 38 | 38 | $this->searchTerm = $val->getToken(); |
| 39 | - } |
|
| 40 | - else |
|
| 39 | + } else |
|
| 41 | 40 | { |
| 42 | 41 | $this->validationResult->makeError( |
| 43 | 42 | t('No search term specified.'), |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | if(in_array($var->getSign(), $this->getAllowedOperands())) |
| 45 | 45 | { |
| 46 | 46 | $this->operandToken = $var->getToken(); |
| 47 | - } |
|
| 48 | - else |
|
| 47 | + } else |
|
| 49 | 48 | { |
| 50 | 49 | $this->validationResult->makeError( |
| 51 | 50 | t('Invalid operand %1$s.', $var->getSign()).' '. |
@@ -54,8 +53,7 @@ discard block |
||
| 54 | 53 | Mailcode_Commands_CommonConstants::VALIDATION_INVALID_OPERAND |
| 55 | 54 | ); |
| 56 | 55 | } |
| 57 | - } |
|
| 58 | - else |
|
| 56 | + } else |
|
| 59 | 57 | { |
| 60 | 58 | $this->validationResult->makeError( |
| 61 | 59 | t('No operand has been specified.'), |
@@ -36,8 +36,7 @@ |
||
| 36 | 36 | if($var->isValid()) |
| 37 | 37 | { |
| 38 | 38 | $this->variableToken = $var->getToken(); |
| 39 | - } |
|
| 40 | - else |
|
| 39 | + } else |
|
| 41 | 40 | { |
| 42 | 41 | $this->validationResult->makeError( |
| 43 | 42 | t('No variable has been specified.'), |