@@ -141,13 +141,11 @@ |
||
141 | 141 | if(!empty($matches[1][$index])) |
142 | 142 | { |
143 | 143 | $name = $matches[1][$index]; |
144 | - } |
|
145 | - else if(!empty($matches[2][$index])) |
|
144 | + } else if(!empty($matches[2][$index])) |
|
146 | 145 | { |
147 | 146 | $name = $matches[2][$index]; |
148 | 147 | $params = $matches[3][$index]; |
149 | - } |
|
150 | - else if(!empty($matches[4][$index])) |
|
148 | + } else if(!empty($matches[4][$index])) |
|
151 | 149 | { |
152 | 150 | $name = $matches[4][$index]; |
153 | 151 | $type = $matches[5][$index]; |
@@ -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 | { |
@@ -70,8 +70,7 @@ |
||
70 | 70 | if($result->isValid()) |
71 | 71 | { |
72 | 72 | $this->formatString = $format; |
73 | - } |
|
74 | - else |
|
73 | + } else |
|
75 | 74 | { |
76 | 75 | $this->validationResult->makeError( |
77 | 76 | $result->getErrorMessage(), |
@@ -97,10 +97,12 @@ |
||
97 | 97 | return self::$commandSets->misc()->comment($comments); |
98 | 98 | } |
99 | 99 | |
100 | - public static function else() : Mailcode_Commands_Command_Else |
|
100 | + public static function else { |
|
101 | + () : Mailcode_Commands_Command_Else |
|
101 | 102 | { |
102 | 103 | return self::$commandSets->if()->else(); |
103 | 104 | } |
105 | + } |
|
104 | 106 | |
105 | 107 | public static function end() : Mailcode_Commands_Command_End |
106 | 108 | { |
@@ -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.', |