@@ -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 |
@@ -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.'), |
@@ -119,8 +119,7 @@ |
||
119 | 119 | if($closing) |
120 | 120 | { |
121 | 121 | array_pop($stack); |
122 | - } |
|
123 | - else |
|
122 | + } else |
|
124 | 123 | { |
125 | 124 | $stack[] = $tagName; |
126 | 125 | } |
@@ -260,8 +260,7 @@ |
||
260 | 260 | if($highlighted) |
261 | 261 | { |
262 | 262 | $formatting->replaceWithHTMLHighlighting(); |
263 | - } |
|
264 | - else |
|
263 | + } else |
|
265 | 264 | { |
266 | 265 | $formatting->replaceWithNormalized(); |
267 | 266 | } |
@@ -146,8 +146,7 @@ discard block |
||
146 | 146 | if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
147 | 147 | { |
148 | 148 | $this->stack[] = $cmd; |
149 | - } |
|
150 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
149 | + } else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
151 | 150 | { |
152 | 151 | array_pop($this->stack); |
153 | 152 | } |
@@ -177,13 +176,11 @@ discard block |
||
177 | 176 | if(!empty($matches[1][$index])) |
178 | 177 | { |
179 | 178 | $name = $matches[1][$index]; |
180 | - } |
|
181 | - else if(!empty($matches[2][$index])) |
|
179 | + } else if(!empty($matches[2][$index])) |
|
182 | 180 | { |
183 | 181 | $name = $matches[2][$index]; |
184 | 182 | $params = $matches[3][$index]; |
185 | - } |
|
186 | - else if(!empty($matches[4][$index])) |
|
183 | + } else if(!empty($matches[4][$index])) |
|
187 | 184 | { |
188 | 185 | $name = $matches[4][$index]; |
189 | 186 | $type = $matches[5][$index]; |
@@ -36,8 +36,7 @@ |
||
36 | 36 | if($var->isValid()) |
37 | 37 | { |
38 | 38 | $this->valueToken = $var->getToken(); |
39 | - } |
|
40 | - else |
|
39 | + } else |
|
41 | 40 | { |
42 | 41 | $this->validationResult->makeError( |
43 | 42 | t('No value has been specified.'), |
@@ -67,78 +67,108 @@ |
||
67 | 67 | |
68 | 68 | public function if(string $condition, string $type='') : string |
69 | 69 | { |
70 | - return $this->command2string(Mailcode_Factory::if()->if($condition, $type)); |
|
70 | + return $this->command2string(Mailcode_Factory::if() { |
|
71 | + ->if($condition, $type)); |
|
72 | + } |
|
71 | 73 | } |
72 | 74 | |
73 | 75 | public function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
74 | 76 | { |
75 | - return $this->command2string(Mailcode_Factory::if()->var($variable, $operand, $value, $quoteValue)); |
|
77 | + return $this->command2string(Mailcode_Factory::if() { |
|
78 | + ->var($variable, $operand, $value, $quoteValue)); |
|
79 | + } |
|
76 | 80 | } |
77 | 81 | |
78 | 82 | public function ifVarString(string $variable, string $operand, string $value) : string |
79 | 83 | { |
80 | - return $this->command2string(Mailcode_Factory::if()->varString($variable, $operand, $value)); |
|
84 | + return $this->command2string(Mailcode_Factory::if() { |
|
85 | + ->varString($variable, $operand, $value)); |
|
86 | + } |
|
81 | 87 | } |
82 | 88 | |
83 | 89 | public function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : string |
84 | 90 | { |
85 | - return $this->command2string(Mailcode_Factory::if()->varEquals($variable, $value, $quoteValue)); |
|
91 | + return $this->command2string(Mailcode_Factory::if() { |
|
92 | + ->varEquals($variable, $value, $quoteValue)); |
|
93 | + } |
|
86 | 94 | } |
87 | 95 | |
88 | 96 | public function ifVarEqualsString(string $variable, string $value) : string |
89 | 97 | { |
90 | - return $this->command2string(Mailcode_Factory::if()->varEqualsString($variable, $value)); |
|
98 | + return $this->command2string(Mailcode_Factory::if() { |
|
99 | + ->varEqualsString($variable, $value)); |
|
100 | + } |
|
91 | 101 | } |
92 | 102 | |
93 | 103 | public function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string |
94 | 104 | { |
95 | - return $this->command2string(Mailcode_Factory::if()->varNotEquals($variable, $value, $quoteValue)); |
|
105 | + return $this->command2string(Mailcode_Factory::if() { |
|
106 | + ->varNotEquals($variable, $value, $quoteValue)); |
|
107 | + } |
|
96 | 108 | } |
97 | 109 | |
98 | 110 | public function ifVarNotEqualsString(string $variable, string $value) : string |
99 | 111 | { |
100 | - return $this->command2string(Mailcode_Factory::if()->varNotEqualsString($variable, $value)); |
|
112 | + return $this->command2string(Mailcode_Factory::if() { |
|
113 | + ->varNotEqualsString($variable, $value)); |
|
114 | + } |
|
101 | 115 | } |
102 | 116 | |
103 | 117 | public function elseIf(string $condition, string $type='') : string |
104 | 118 | { |
105 | - return $this->command2string(Mailcode_Factory::elseIf()->elseIf($condition, $type)); |
|
119 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
120 | + ->elseIf($condition, $type)); |
|
121 | + } |
|
106 | 122 | } |
107 | 123 | |
108 | 124 | public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string |
109 | 125 | { |
110 | - return $this->command2string(Mailcode_Factory::elseIf()->var($variable, $operand, $value, $quoteValue)); |
|
126 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
127 | + ->var($variable, $operand, $value, $quoteValue)); |
|
128 | + } |
|
111 | 129 | } |
112 | 130 | |
113 | 131 | public function elseIfVarString(string $variable, string $operand, string $value) : string |
114 | 132 | { |
115 | - return $this->command2string(Mailcode_Factory::elseIf()->varString($variable, $operand, $value)); |
|
133 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
134 | + ->varString($variable, $operand, $value)); |
|
135 | + } |
|
116 | 136 | } |
117 | 137 | |
118 | 138 | public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : string |
119 | 139 | { |
120 | - return $this->command2string(Mailcode_Factory::elseIf()->varEquals($variable, $value, $quoteValue)); |
|
140 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
141 | + ->varEquals($variable, $value, $quoteValue)); |
|
142 | + } |
|
121 | 143 | } |
122 | 144 | |
123 | 145 | public function elseIfVarEqualsString(string $variable, string $value) : string |
124 | 146 | { |
125 | - return $this->command2string(Mailcode_Factory::elseIf()->varEqualsString($variable, $value)); |
|
147 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
148 | + ->varEqualsString($variable, $value)); |
|
149 | + } |
|
126 | 150 | } |
127 | 151 | |
128 | 152 | public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string |
129 | 153 | { |
130 | - return $this->command2string(Mailcode_Factory::elseIf()->varNotEquals($variable, $value, $quoteValue)); |
|
154 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
155 | + ->varNotEquals($variable, $value, $quoteValue)); |
|
156 | + } |
|
131 | 157 | } |
132 | 158 | |
133 | 159 | public function elseIfVarNotEqualsString(string $variable, string $value) : string |
134 | 160 | { |
135 | - return $this->command2string(Mailcode_Factory::elseIf()->varNotEqualsString($variable, $value)); |
|
161 | + return $this->command2string(Mailcode_Factory::elseIf() { |
|
162 | + ->varNotEqualsString($variable, $value)); |
|
163 | + } |
|
136 | 164 | } |
137 | 165 | |
138 | - public function else() : string |
|
166 | + public function else { |
|
167 | + () : string |
|
139 | 168 | { |
140 | 169 | return $this->command2string(Mailcode_Factory::elseIf()->else()); |
141 | 170 | } |
171 | + } |
|
142 | 172 | |
143 | 173 | public function end() : string |
144 | 174 | { |