Passed
Push — master ( acaf2a...2147dc )
by Sebastian
02:19
created
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowDate.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 {
25 25
     const ERROR_UNKNOWN_DATE_FORMAT_CHARACTER = 55501;
26 26
 
27
-   /**
28
-    * The date format used in the date variable. This is used to convert
29
-    * the native date to the format specified in the variable command.
30
-    */
27
+    /**
28
+     * The date format used in the date variable. This is used to convert
29
+     * the native date to the format specified in the variable command.
30
+     */
31 31
     const DEFAULT_INTERNAL_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
32 32
 
33
-   /**
34
-    * @var string[]string
35
-    */
33
+    /**
34
+     * @var string[]string
35
+     */
36 36
     private $charTable = array(
37 37
         'd' => 'd',
38 38
         'm' => 'M',
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $internalFormat = $command->getTranslationParam('internal_format');
54 54
 
55
-        if(empty($internalFormat))
55
+        if (empty($internalFormat))
56 56
         {
57 57
             $internalFormat = self::DEFAULT_INTERNAL_FORMAT;
58 58
         }
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
         $chars = ConvertHelper::string2array($formatString);
71 71
         $result = array();
72 72
         
73
-        foreach($chars as $char)
73
+        foreach ($chars as $char)
74 74
         {
75
-            if(!isset($this->charTable[$char]))
75
+            if (!isset($this->charTable[$char]))
76 76
             {
77 77
                 throw new Mailcode_Translator_Exception(
78 78
                     'Unknown date format string character',
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -32,44 +32,44 @@  discard block
 block discarded – undo
32 32
     const VALIDATION_UNKNOWN_COMMAND_NAME = 48304;
33 33
     const VALIDATION_INVALID_PARAMS_STATEMENT = 48305;
34 34
 
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected $type = '';
39 39
 
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $paramsString = '';
44 44
     
45
-   /**
46
-    * @var string
47
-    */
45
+    /**
46
+     * @var string
47
+     */
48 48
     protected $matchedText = '';
49 49
 
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $hash = '';
54 54
     
55
-   /**
56
-    * @var \AppUtils\OperationResult
57
-    */
55
+    /**
56
+     * @var \AppUtils\OperationResult
57
+     */
58 58
     protected $validationResult = null;
59 59
     
60
-   /**
61
-    * @var \Mailcode\Mailcode
62
-    */
60
+    /**
61
+     * @var \Mailcode\Mailcode
62
+     */
63 63
     protected $mailcode;
64 64
     
65
-   /**
66
-    * @var \Mailcode\Mailcode_Parser_Statement
67
-    */
65
+    /**
66
+     * @var \Mailcode\Mailcode_Parser_Statement
67
+     */
68 68
     protected $params;
69 69
 
70
-   /**
71
-    * @var string[] 
72
-    */
70
+    /**
71
+     * @var string[] 
72
+     */
73 73
     protected $validations = array(
74 74
         'params_empty',
75 75
         'params_keywords',
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
         'type_unsupported'
79 79
     );
80 80
     
81
-   /**
82
-    * @var string
83
-    */
81
+    /**
82
+     * @var string
83
+     */
84 84
     protected $comment = '';
85 85
     
86
-   /**
87
-    * @var Mailcode_Commands_LogicKeywords|NULL
88
-    */
86
+    /**
87
+     * @var Mailcode_Commands_LogicKeywords|NULL
88
+     */
89 89
     protected $logicKeywords;
90 90
     
91
-   /**
92
-    * @var Mailcode_Parser_Statement_Validator
93
-    */
91
+    /**
92
+     * @var Mailcode_Parser_Statement_Validator
93
+     */
94 94
     protected $validator;
95 95
     
96
-   /**
97
-    * @var boolean
98
-    */
96
+    /**
97
+     * @var boolean
98
+     */
99 99
     private $validated = false;
100 100
 
101 101
     /**
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
         
126 126
     }
127 127
 
128
-   /**
129
-    * Sets the command's parent opening command, if any.
130
-    * NOTE: This is set automatically by the parser, and
131
-    * should not be called manually.
132
-    *
133
-    * @param Mailcode_Commands_Command $command
134
-    */
128
+    /**
129
+     * Sets the command's parent opening command, if any.
130
+     * NOTE: This is set automatically by the parser, and
131
+     * should not be called manually.
132
+     *
133
+     * @param Mailcode_Commands_Command $command
134
+     */
135 135
     public function setParent(Mailcode_Commands_Command $command) : void
136 136
     {
137 137
         $this->parent = $command;
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         return $this->parent;
148 148
     }
149 149
     
150
-   /**
151
-    * @return string The ID of the command = the name of the command class file.
152
-    */
150
+    /**
151
+     * @return string The ID of the command = the name of the command class file.
152
+     */
153 153
     public function getID() : string
154 154
     {
155 155
         // account for commands with types: If_Variable should still return If.
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         return array_shift($tokens);
159 159
     }
160 160
     
161
-   /**
162
-    * Sets an optional comment that is not used anywhere, but
163
-    * can be used by the application to track why a command is
164
-    * used somewhere. 
165
-    * 
166
-    * @param string $comment
167
-    * @return Mailcode_Commands_Command
168
-    */
161
+    /**
162
+     * Sets an optional comment that is not used anywhere, but
163
+     * can be used by the application to track why a command is
164
+     * used somewhere. 
165
+     * 
166
+     * @param string $comment
167
+     * @return Mailcode_Commands_Command
168
+     */
169 169
     public function setComment(string $comment) : Mailcode_Commands_Command
170 170
     {
171 171
         $this->comment = $comment;
@@ -173,34 +173,34 @@  discard block
 block discarded – undo
173 173
         return $this;
174 174
     }
175 175
     
176
-   /**
177
-    * Retrieves the previously set comment, if any.
178
-    * 
179
-    * @return string
180
-    */
176
+    /**
177
+     * Retrieves the previously set comment, if any.
178
+     * 
179
+     * @return string
180
+     */
181 181
     public function getComment() : string
182 182
     {
183 183
         return $this->comment;
184 184
     }
185 185
     
186
-   /**
187
-    * Checks whether this is a dummy command, which is only
188
-    * used to access information on the command type. It cannot
189
-    * be used as an actual live command.
190
-    * 
191
-    * @return bool
192
-    */
186
+    /**
187
+     * Checks whether this is a dummy command, which is only
188
+     * used to access information on the command type. It cannot
189
+     * be used as an actual live command.
190
+     * 
191
+     * @return bool
192
+     */
193 193
     public function isDummy() : bool
194 194
     {
195 195
         return $this->type === '__dummy';
196 196
     }
197 197
     
198
-   /**
199
-    * Retrieves a hash of the actual matched command string,
200
-    * which is used in collections to detect duplicate commands.
201
-    * 
202
-    * @return string
203
-    */
198
+    /**
199
+     * Retrieves a hash of the actual matched command string,
200
+     * which is used in collections to detect duplicate commands.
201
+     * 
202
+     * @return string
203
+     */
204 204
     public function getHash() : string
205 205
     {
206 206
         $this->requireNonDummy();
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
         return $this->validationResult->isValid();
295 295
     }
296 296
     
297
-   /**
298
-    * @return string[]
299
-    */
297
+    /**
298
+     * @return string[]
299
+     */
300 300
     abstract protected function getValidations() : array;
301 301
     
302 302
     protected function validateSyntax_params_empty() : void
@@ -455,12 +455,12 @@  discard block
 block discarded – undo
455 455
     
456 456
     abstract public function supportsType() : bool;
457 457
     
458
-   /**
459
-    * Whether the command allows using logic keywords like "and:" or "or:"
460
-    * in the command parameters.
461
-    * 
462
-    * @return bool
463
-    */
458
+    /**
459
+     * Whether the command allows using logic keywords like "and:" or "or:"
460
+     * in the command parameters.
461
+     * 
462
+     * @return bool
463
+     */
464 464
     abstract public function supportsLogicKeywords() : bool;
465 465
     
466 466
     abstract public function generatesContent() : bool;
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
         return $normalizer->normalize();
507 507
     }
508 508
     
509
-   /**
510
-    * Retrieves the names of all the command's supported types: the part
511
-    * between the command name and the colon. Example: {command type: params}.
512
-    * 
513
-    * @return string[]
514
-    */
509
+    /**
510
+     * Retrieves the names of all the command's supported types: the part
511
+     * between the command name and the colon. Example: {command type: params}.
512
+     * 
513
+     * @return string[]
514
+     */
515 515
     public function getSupportedTypes() : array
516 516
     {
517 517
         return array();
518 518
     }
519 519
     
520
-   /**
521
-    * Retrieves all variable names used in the command.
522
-    * 
523
-    * @return Mailcode_Variables_Collection_Regular
524
-    */
520
+    /**
521
+     * Retrieves all variable names used in the command.
522
+     * 
523
+     * @return Mailcode_Variables_Collection_Regular
524
+     */
525 525
     public function getVariables() : Mailcode_Variables_Collection_Regular
526 526
     {
527 527
         return Mailcode::create()->findVariables($this->paramsString);
@@ -546,26 +546,26 @@  discard block
 block discarded – undo
546 546
         );
547 547
     }
548 548
 
549
-   /**
550
-    * Sets a parameter for the translation backend. The backend can use
551
-    * these to allow command-specific configurations.
552
-    *
553
-    * @param string $name
554
-    * @param mixed $value
555
-    * @return $this
556
-    */
549
+    /**
550
+     * Sets a parameter for the translation backend. The backend can use
551
+     * these to allow command-specific configurations.
552
+     *
553
+     * @param string $name
554
+     * @param mixed $value
555
+     * @return $this
556
+     */
557 557
     public function setTranslationParam(string $name, $value)
558 558
     {
559 559
         $this->translationParams[$name] = $value;
560 560
         return $this;
561 561
     }
562 562
 
563
-   /**
564
-    * Retrieves a previously set translation parameter.
565
-    *
566
-    * @param string $name
567
-    * @return mixed
568
-    */
563
+    /**
564
+     * Retrieves a previously set translation parameter.
565
+     *
566
+     * @param string $name
567
+     * @return mixed
568
+     */
569 569
     public function getTranslationParam(string $name)
570 570
     {
571 571
         if(isset($this->translationParams[$name]))
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     protected $parent = null;
111 111
 
112
-    public function __construct(string $type='', string $paramsString='', string $matchedText='')
112
+    public function __construct(string $type = '', string $paramsString = '', string $matchedText = '')
113 113
     {
114 114
         $this->type = $type;
115 115
         $this->paramsString = html_entity_decode($paramsString);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     {
206 206
         $this->requireNonDummy();
207 207
         
208
-        if($this->hash === '') {
208
+        if ($this->hash === '') {
209 209
             $this->hash = md5($this->matchedText);
210 210
         }
211 211
         
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     
215 215
     protected function requireNonDummy() : void
216 216
     {
217
-        if(!$this->isDummy())
217
+        if (!$this->isDummy())
218 218
         {
219 219
             return;
220 220
         }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     
234 234
     protected function validate() : \AppUtils\OperationResult
235 235
     {
236
-        if(!$this->validated)
236
+        if (!$this->validated)
237 237
         {
238 238
             $this->requireNonDummy();
239 239
             $this->validateSyntax();
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     
247 247
     public function getValidationResult() :  \AppUtils\OperationResult
248 248
     {
249
-        if(isset($this->validationResult)) 
249
+        if (isset($this->validationResult)) 
250 250
         {
251 251
             return $this->validationResult;
252 252
         }
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $validations = array_merge($this->validations, $this->getValidations());
264 264
         
265
-        foreach($validations as $validation)
265
+        foreach ($validations as $validation)
266 266
         {
267 267
             // break off at the first validation issue
268
-            if(!$this->validateSyntaxMethod($validation))
268
+            if (!$this->validateSyntaxMethod($validation))
269 269
             {
270 270
                 return;
271 271
             }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $method = 'validateSyntax_'.$validation;
278 278
         
279
-        if(!method_exists($this, $method))
279
+        if (!method_exists($this, $method))
280 280
         {
281 281
             throw new Mailcode_Exception(
282 282
                 'Missing validation method ['.$validation.']',
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
     
302 302
     protected function validateSyntax_params_empty() : void
303 303
     {
304
-        if(!$this->requiresParameters())
304
+        if (!$this->requiresParameters())
305 305
         {
306 306
             return;
307 307
         }
308 308
         
309
-        if(empty($this->paramsString))
309
+        if (empty($this->paramsString))
310 310
         {
311 311
             $this->validationResult->makeError(
312 312
                 t('Parameters have to be specified.'),
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
     
319 319
     protected function validateSyntax_params_keywords() : void
320 320
     {
321
-        if(!$this->supportsLogicKeywords())
321
+        if (!$this->supportsLogicKeywords())
322 322
         {
323 323
             return;
324 324
         }
325 325
         
326 326
         $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString);
327 327
         
328
-        if(!$this->logicKeywords->isValid())
328
+        if (!$this->logicKeywords->isValid())
329 329
         {
330 330
             $this->validationResult->makeError(
331 331
                 t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(),
@@ -340,14 +340,14 @@  discard block
 block discarded – undo
340 340
     
341 341
     protected function validateSyntax_params_parse() : void
342 342
     {
343
-        if(!$this->requiresParameters())
343
+        if (!$this->requiresParameters())
344 344
         {
345 345
             return;
346 346
         }
347 347
         
348 348
         $this->params = $this->mailcode->getParser()->createStatement($this->paramsString);
349 349
         
350
-        if(!$this->params->isValid())
350
+        if (!$this->params->isValid())
351 351
         {
352 352
             $error = $this->params->getValidationResult();
353 353
             
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
     
365 365
     protected function validateSyntax_type_supported() : void
366 366
     {
367
-        if(!$this->supportsType() || empty($this->type))
367
+        if (!$this->supportsType() || empty($this->type))
368 368
         {
369 369
             return;
370 370
         }
371 371
         
372 372
         $types = $this->getSupportedTypes();
373 373
 
374
-        if(!in_array($this->type, $types))
374
+        if (!in_array($this->type, $types))
375 375
         {
376 376
             $this->validationResult->makeError(
377 377
                 t('The command addon %1$s is not supported.', $this->type).' '.
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     
386 386
     protected function validateSyntax_type_unsupported() : void
387 387
     {
388
-        if($this->supportsType() || empty($this->type))
388
+        if ($this->supportsType() || empty($this->type))
389 389
         {
390 390
             return;
391 391
         }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     
404 404
     public function getType() : string
405 405
     {
406
-        if($this->supportsType())
406
+        if ($this->supportsType())
407 407
         {
408 408
             return $this->type;
409 409
         }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     
424 424
     public function getHighlighted() : string
425 425
     {
426
-        if(!$this->isValid())
426
+        if (!$this->isValid())
427 427
         {
428 428
             return '';
429 429
         }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     
435 435
     public function getParamsString() : string
436 436
     {
437
-        if($this->requiresParameters())
437
+        if ($this->requiresParameters())
438 438
         {
439 439
             return $this->paramsString;
440 440
         }
@@ -469,22 +469,22 @@  discard block
 block discarded – undo
469 469
     
470 470
     public final function getCommandType() : string
471 471
     {
472
-        if($this instanceof Mailcode_Commands_Command_Type_Closing)
472
+        if ($this instanceof Mailcode_Commands_Command_Type_Closing)
473 473
         {
474 474
             return 'Closing';
475 475
         }
476 476
         
477
-        if($this instanceof Mailcode_Commands_Command_Type_Opening)
477
+        if ($this instanceof Mailcode_Commands_Command_Type_Opening)
478 478
         {
479 479
             return 'Opening';
480 480
         }
481 481
         
482
-        if($this instanceof Mailcode_Commands_Command_Type_Sibling)
482
+        if ($this instanceof Mailcode_Commands_Command_Type_Sibling)
483 483
         {
484 484
             return 'Sibling';
485 485
         }
486 486
         
487
-        if($this instanceof Mailcode_Commands_Command_Type_Standalone)
487
+        if ($this instanceof Mailcode_Commands_Command_Type_Standalone)
488 488
         {
489 489
             return 'Standalone';
490 490
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     
535 535
     public function getLogicKeywords() : Mailcode_Commands_LogicKeywords
536 536
     {
537
-        if($this->supportsLogicKeywords() && isset($this->logicKeywords))
537
+        if ($this->supportsLogicKeywords() && isset($this->logicKeywords))
538 538
         {
539 539
             return $this->logicKeywords;
540 540
         }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
     */
569 569
     public function getTranslationParam(string $name)
570 570
     {
571
-        if(isset($this->translationParams[$name]))
571
+        if (isset($this->translationParams[$name]))
572 572
         {
573 573
             return $this->translationParams[$name];
574 574
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
         '{\s*([a-z]+)\s+([a-z-]+)\s*:([^}]*)}'
29 29
     );
30 30
     
31
-   /**
32
-    * @var Mailcode
33
-    */
31
+    /**
32
+     * @var Mailcode
33
+     */
34 34
     protected $mailcode;
35 35
     
36
-   /**
37
-    * @var Mailcode_Commands
38
-    */
36
+    /**
37
+     * @var Mailcode_Commands
38
+     */
39 39
     protected $commands;
40 40
 
41 41
     /**
@@ -49,24 +49,24 @@  discard block
 block discarded – undo
49 49
         $this->commands = $this->mailcode->getCommands();
50 50
     }
51 51
     
52
-   /**
53
-    * Gets the regex format string used to detect commands.
54
-    * 
55
-    * @return string
56
-    */
52
+    /**
53
+     * Gets the regex format string used to detect commands.
54
+     * 
55
+     * @return string
56
+     */
57 57
     protected static function getRegex() : string
58 58
     {
59 59
         return '/'.implode('|', self::COMMAND_REGEX_PARTS).'/sixU';
60 60
     }
61 61
     
62
-   /**
63
-    * Parses a string to detect all commands within. Returns a
64
-    * collection instance that contains information on all the 
65
-    * commands.
66
-    * 
67
-    * @param string $string
68
-    * @return Mailcode_Collection A collection with all unique commands found.
69
-    */
62
+    /**
63
+     * Parses a string to detect all commands within. Returns a
64
+     * collection instance that contains information on all the 
65
+     * commands.
66
+     * 
67
+     * @param string $string
68
+     * @return Mailcode_Collection A collection with all unique commands found.
69
+     */
70 70
     public function parseString(string $string) : Mailcode_Collection
71 71
     {
72 72
         $collection = new Mailcode_Collection();
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
         return preg_replace('%<style\b[^>]*>(.*?)</style>%six', '', $subject);
100 100
     }
101 101
     
102
-   /**
103
-    * Processes a single match found in the string: creates the command,
104
-    * and adds it to the collection if it's a valid command, or to the list
105
-    * of invalid commands otherwise.
106
-    * 
107
-    * @param Mailcode_Parser_Match $match
108
-    * @param Mailcode_Collection $collection
109
-    */
102
+    /**
103
+     * Processes a single match found in the string: creates the command,
104
+     * and adds it to the collection if it's a valid command, or to the list
105
+     * of invalid commands otherwise.
106
+     * 
107
+     * @param Mailcode_Parser_Match $match
108
+     * @param Mailcode_Collection $collection
109
+     */
110 110
     protected function processMatch(Mailcode_Parser_Match $match, Mailcode_Collection $collection) : void
111 111
     {
112 112
         $name = $match->getName();
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
         }
154 154
     }
155 155
     
156
-   /**
157
-    * Parses a single regex match: determines which named group
158
-    * matches, and retrieves the according information.
159
-    * 
160
-    * @param array[] $matches The regex results array.
161
-    * @param int $index The matched index.
162
-    * @return Mailcode_Parser_Match
163
-    */
156
+    /**
157
+     * Parses a single regex match: determines which named group
158
+     * matches, and retrieves the according information.
159
+     * 
160
+     * @param array[] $matches The regex results array.
161
+     * @param int $index The matched index.
162
+     * @return Mailcode_Parser_Match
163
+     */
164 164
     protected function parseMatch(array $matches, int $index) : Mailcode_Parser_Match
165 165
     {
166 166
         $name = ''; // the command name, e.g. "showvar"
@@ -198,26 +198,26 @@  discard block
 block discarded – undo
198 198
         );
199 199
     }
200 200
     
201
-   /**
202
-    * Creates an instance of the safeguard tool, which
203
-    * is used to safeguard commands in a string with placeholders.
204
-    * 
205
-    * @param string $subject The string to use to safeguard commands in.
206
-    * @return Mailcode_Parser_Safeguard
207
-    * @see Mailcode_Parser_Safeguard
208
-    */
201
+    /**
202
+     * Creates an instance of the safeguard tool, which
203
+     * is used to safeguard commands in a string with placeholders.
204
+     * 
205
+     * @param string $subject The string to use to safeguard commands in.
206
+     * @return Mailcode_Parser_Safeguard
207
+     * @see Mailcode_Parser_Safeguard
208
+     */
209 209
     public function createSafeguard(string $subject) : Mailcode_Parser_Safeguard
210 210
     {
211 211
         return new Mailcode_Parser_Safeguard($this, $subject);
212 212
     }
213 213
     
214
-   /**
215
-    * Creates a statement parser, which is used to validate arbitrary
216
-    * command statements.
217
-    * 
218
-    * @param string $statement
219
-    * @return Mailcode_Parser_Statement
220
-    */
214
+    /**
215
+     * Creates a statement parser, which is used to validate arbitrary
216
+     * command statements.
217
+     * 
218
+     * @param string $statement
219
+     * @return Mailcode_Parser_Statement
220
+     */
221 221
     public function createStatement(string $statement) : Mailcode_Parser_Statement
222 222
     {
223 223
         return new Mailcode_Parser_Statement($statement);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         
79 79
         $total = count($matches[0]);
80 80
         
81
-        for($i=0; $i < $total; $i++)
81
+        for ($i = 0; $i < $total; $i++)
82 82
         {
83 83
             $match = $this->parseMatch($matches, $i);
84 84
             
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     
91 91
     protected function prepareString(string $subject) : string
92 92
     {
93
-        if(!ConvertHelper::isStringHTML($subject))
93
+        if (!ConvertHelper::isStringHTML($subject))
94 94
         {
95 95
             return $subject;
96 96
         }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $name = $match->getName();
113 113
         
114
-        if(!$this->commands->nameExists($name))
114
+        if (!$this->commands->nameExists($name))
115 115
         {
116 116
             $collection->addErrorMessage(
117 117
                 $match->getMatchedString(),
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $match->getMatchedString()
129 129
         );
130 130
         
131
-        if(!$cmd->isValid())
131
+        if (!$cmd->isValid())
132 132
         {
133 133
             $collection->addInvalidCommand($cmd);
134 134
             return;
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
         $collection->addCommand($cmd);
138 138
 
139 139
         // Set the command's parent from the stack, if any is present.
140
-        if(!empty($this->stack))
140
+        if (!empty($this->stack))
141 141
         {
142 142
             $cmd->setParent($this->stack[array_key_last($this->stack)]);
143 143
         }
144 144
 
145 145
         // Handle opening and closing commands, adding and removing from the stack.
146
-        if($cmd instanceof Mailcode_Commands_Command_Type_Opening)
146
+        if ($cmd instanceof Mailcode_Commands_Command_Type_Opening)
147 147
         {
148 148
             $this->stack[] = $cmd;
149 149
         }
150
-        else if($cmd instanceof Mailcode_Commands_Command_Type_Closing)
150
+        else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing)
151 151
         {
152 152
             array_pop($this->stack);
153 153
         }
@@ -174,16 +174,16 @@  discard block
 block discarded – undo
174 174
         // 5 = parameter type command, type
175 175
         // 6 = parameter type command, params
176 176
         
177
-        if(!empty($matches[1][$index]))
177
+        if (!empty($matches[1][$index]))
178 178
         {
179 179
             $name = $matches[1][$index];
180 180
         }
181
-        else if(!empty($matches[2][$index]))
181
+        else if (!empty($matches[2][$index]))
182 182
         {
183 183
             $name = $matches[2][$index];
184 184
             $params = $matches[3][$index];
185 185
         }
186
-        else if(!empty($matches[4][$index]))
186
+        else if (!empty($matches[4][$index]))
187 187
         {
188 188
             $name = $matches[4][$index];
189 189
             $type = $matches[5][$index];
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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];
Please login to merge, or discard this patch.