@@ -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 = html_entity_decode($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(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $errors = $this->errors; |
101 | 101 | |
102 | - if(!$result->isValid()) |
|
102 | + if (!$result->isValid()) |
|
103 | 103 | { |
104 | 104 | $errors[] = new Mailcode_Collection_Error_Message( |
105 | 105 | '', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $errors = $this->getErrors(); |
117 | 117 | |
118 | - if(!empty($errors)) |
|
118 | + if (!empty($errors)) |
|
119 | 119 | { |
120 | 120 | return array_shift($errors); |
121 | 121 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | { |
158 | 158 | $hashes = array(); |
159 | 159 | |
160 | - foreach($this->commands as $command) |
|
160 | + foreach ($this->commands as $command) |
|
161 | 161 | { |
162 | 162 | $hash = $command->getHash(); |
163 | 163 | |
164 | - if(!isset($hashes[$hash])) |
|
164 | + if (!isset($hashes[$hash])) |
|
165 | 165 | { |
166 | 166 | $hashes[$hash] = $command; |
167 | 167 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function addCommands(array $commands) : Mailcode_Collection |
180 | 180 | { |
181 | - foreach($commands as $command) |
|
181 | + foreach ($commands as $command) |
|
182 | 182 | { |
183 | 183 | $this->addCommand($command); |
184 | 184 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $collection = new Mailcode_Variables_Collection_Regular(); |
199 | 199 | |
200 | - foreach($this->commands as $command) |
|
200 | + foreach ($this->commands as $command) |
|
201 | 201 | { |
202 | 202 | $collection->mergeWith($command->getVariables()); |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function getValidationResult() : OperationResult |
209 | 209 | { |
210 | - if(isset($this->validationResult)) |
|
210 | + if (isset($this->validationResult)) |
|
211 | 211 | { |
212 | 212 | return $this->validationResult; |
213 | 213 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | { |
224 | 224 | $errors = $this->getErrors(); |
225 | 225 | |
226 | - foreach($errors as $error) |
|
226 | + foreach ($errors as $error) |
|
227 | 227 | { |
228 | - if($error->getCode() === $code) |
|
228 | + if ($error->getCode() === $code) |
|
229 | 229 | { |
230 | 230 | return true; |
231 | 231 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | { |
244 | 244 | $result = array(); |
245 | 245 | |
246 | - foreach($this->commands as $command) |
|
246 | + foreach ($this->commands as $command) |
|
247 | 247 | { |
248 | - if($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
248 | + if ($command instanceof Mailcode_Commands_Command_ShowVariable) |
|
249 | 249 | { |
250 | 250 | $result[] = $command; |
251 | 251 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | { |
259 | 259 | $commands = $this->getCommands(); |
260 | 260 | |
261 | - if(!empty($commands)) |
|
261 | + if (!empty($commands)) |
|
262 | 262 | { |
263 | 263 | return array_shift($commands); |
264 | 264 | } |