Passed
Push — master ( 5ccc42...a49720 )
by Sebastian
02:49
created
src/Mailcode/Parser/Statement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected $freeform = false;
53 53
 
54
-    public function __construct(string $statement, bool $freeform=false)
54
+    public function __construct(string $statement, bool $freeform = false)
55 55
     {
56 56
         $this->statement = $statement;
57 57
         $this->result = new OperationResult($this);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     
81 81
     public function getInfo() : Mailcode_Parser_Statement_Info
82 82
     {
83
-        if($this->info instanceof Mailcode_Parser_Statement_Info)
83
+        if ($this->info instanceof Mailcode_Parser_Statement_Info)
84 84
         {
85 85
             return $this->info; 
86 86
         }
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
     
93 93
     protected function validate() : void
94 94
     {
95
-        if($this->freeform)
95
+        if ($this->freeform)
96 96
         {
97 97
             return;
98 98
         }
99 99
 
100
-        if(!$this->tokenizer->hasTokens())
100
+        if (!$this->tokenizer->hasTokens())
101 101
         {
102 102
             $this->result->makeError(
103 103
                 t('Empty statement'),
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         
110 110
         $unknown = $this->tokenizer->getFirstUnknown();
111 111
         
112
-        if($unknown)
112
+        if ($unknown)
113 113
         {
114 114
             $this->result->makeError(
115 115
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected $parent = null;
116 116
 
117
-    public function __construct(string $type='', string $paramsString='', string $matchedText='')
117
+    public function __construct(string $type = '', string $paramsString = '', string $matchedText = '')
118 118
     {
119 119
         $this->type = $type;
120 120
         $this->paramsString = html_entity_decode($paramsString);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $this->requireNonDummy();
212 212
         
213
-        if($this->hash === '') {
213
+        if ($this->hash === '') {
214 214
             $this->hash = md5($this->matchedText);
215 215
         }
216 216
         
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     
220 220
     protected function requireNonDummy() : void
221 221
     {
222
-        if(!$this->isDummy())
222
+        if (!$this->isDummy())
223 223
         {
224 224
             return;
225 225
         }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     
239 239
     protected function validate() : OperationResult
240 240
     {
241
-        if(!$this->validated)
241
+        if (!$this->validated)
242 242
         {
243 243
             $this->requireNonDummy();
244 244
             $this->validateSyntax();
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     
252 252
     public function getValidationResult() :  OperationResult
253 253
     {
254
-        if(isset($this->validationResult)) 
254
+        if (isset($this->validationResult)) 
255 255
         {
256 256
             return $this->validationResult;
257 257
         }
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $validations = $this->resolveValidations();
269 269
 
270
-        foreach($validations as $validation)
270
+        foreach ($validations as $validation)
271 271
         {
272 272
             // break off at the first validation issue
273
-            if(!$this->validateSyntaxMethod($validation))
273
+            if (!$this->validateSyntaxMethod($validation))
274 274
             {
275 275
                 return;
276 276
             }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $method = 'validateSyntax_'.$validation;
291 291
         
292
-        if(!method_exists($this, $method))
292
+        if (!method_exists($this, $method))
293 293
         {
294 294
             throw new Mailcode_Exception(
295 295
                 'Missing validation method ['.$validation.']',
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
     
315 315
     protected function validateSyntax_params_empty() : void
316 316
     {
317
-        if(!$this->requiresParameters())
317
+        if (!$this->requiresParameters())
318 318
         {
319 319
             return;
320 320
         }
321 321
         
322
-        if(empty($this->paramsString))
322
+        if (empty($this->paramsString))
323 323
         {
324 324
             $this->validationResult->makeError(
325 325
                 t('Parameters have to be specified.'),
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
     
332 332
     protected function validateSyntax_params_keywords() : void
333 333
     {
334
-        if(!$this->supportsLogicKeywords())
334
+        if (!$this->supportsLogicKeywords())
335 335
         {
336 336
             return;
337 337
         }
338 338
         
339 339
         $this->logicKeywords = new Mailcode_Commands_LogicKeywords($this, $this->paramsString);
340 340
         
341
-        if(!$this->logicKeywords->isValid())
341
+        if (!$this->logicKeywords->isValid())
342 342
         {
343 343
             $this->validationResult->makeError(
344 344
                 t('Invalid parameters:').' '.$this->logicKeywords->getErrorMessage(),
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     
354 354
     protected function validateSyntax_params_parse() : void
355 355
     {
356
-        if(!$this->requiresParameters())
356
+        if (!$this->requiresParameters())
357 357
         {
358 358
             return;
359 359
         }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             $this->hasFreeformParameters()
364 364
         );
365 365
 
366
-        if(!$this->params->isValid())
366
+        if (!$this->params->isValid())
367 367
         {
368 368
             $error = $this->params->getValidationResult();
369 369
             
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 
386 386
     protected function validateSyntax_type_supported() : void
387 387
     {
388
-        if(!$this->supportsType() || empty($this->type))
388
+        if (!$this->supportsType() || empty($this->type))
389 389
         {
390 390
             return;
391 391
         }
392 392
         
393 393
         $types = $this->getSupportedTypes();
394 394
 
395
-        if(!in_array($this->type, $types))
395
+        if (!in_array($this->type, $types))
396 396
         {
397 397
             $this->validationResult->makeError(
398 398
                 t('The command addon %1$s is not supported.', $this->type).' '.
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     
407 407
     protected function validateSyntax_type_unsupported() : void
408 408
     {
409
-        if($this->supportsType() || empty($this->type))
409
+        if ($this->supportsType() || empty($this->type))
410 410
         {
411 411
             return;
412 412
         }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     
425 425
     public function getType() : string
426 426
     {
427
-        if($this->supportsType())
427
+        if ($this->supportsType())
428 428
         {
429 429
             return $this->type;
430 430
         }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     
445 445
     public function getHighlighted() : string
446 446
     {
447
-        if(!$this->isValid())
447
+        if (!$this->isValid())
448 448
         {
449 449
             return '';
450 450
         }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     
456 456
     public function getParamsString() : string
457 457
     {
458
-        if($this->requiresParameters())
458
+        if ($this->requiresParameters())
459 459
         {
460 460
             return $this->paramsString;
461 461
         }
@@ -492,22 +492,22 @@  discard block
 block discarded – undo
492 492
     
493 493
     public final function getCommandType() : string
494 494
     {
495
-        if($this instanceof Mailcode_Commands_Command_Type_Closing)
495
+        if ($this instanceof Mailcode_Commands_Command_Type_Closing)
496 496
         {
497 497
             return 'Closing';
498 498
         }
499 499
         
500
-        if($this instanceof Mailcode_Commands_Command_Type_Opening)
500
+        if ($this instanceof Mailcode_Commands_Command_Type_Opening)
501 501
         {
502 502
             return 'Opening';
503 503
         }
504 504
         
505
-        if($this instanceof Mailcode_Commands_Command_Type_Sibling)
505
+        if ($this instanceof Mailcode_Commands_Command_Type_Sibling)
506 506
         {
507 507
             return 'Sibling';
508 508
         }
509 509
         
510
-        if($this instanceof Mailcode_Commands_Command_Type_Standalone)
510
+        if ($this instanceof Mailcode_Commands_Command_Type_Standalone)
511 511
         {
512 512
             return 'Standalone';
513 513
         }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     
558 558
     public function getLogicKeywords() : Mailcode_Commands_LogicKeywords
559 559
     {
560
-        if($this->supportsLogicKeywords() && isset($this->logicKeywords))
560
+        if ($this->supportsLogicKeywords() && isset($this->logicKeywords))
561 561
         {
562 562
             return $this->logicKeywords;
563 563
         }
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     */
592 592
     public function getTranslationParam(string $name)
593 593
     {
594
-        if(isset($this->translationParams[$name]))
594
+        if (isset($this->translationParams[$name]))
595 595
         {
596 596
             return $this->translationParams[$name];
597 597
         }
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
      * @param bool $encoding
604 604
      * @return $this
605 605
      */
606
-    public function setURLEncoding(bool $encoding=true)
606
+    public function setURLEncoding(bool $encoding = true)
607 607
     {
608 608
         $this->requireURLEncoding();
609 609
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
      * @return $this
620 620
      * @throws Mailcode_Exception
621 621
      */
622
-    public function setURLDecoding(bool $decode=true)
622
+    public function setURLDecoding(bool $decode = true)
623 623
     {
624 624
         $this->requireURLEncoding();
625 625
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 
631 631
     protected function requireURLEncoding() : void
632 632
     {
633
-        if($this->supportsURLEncoding()) {
633
+        if ($this->supportsURLEncoding()) {
634 634
             return;
635 635
         }
636 636
 
Please login to merge, or discard this patch.
src/Mailcode/Commands/ShowBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 
71 71
     protected function validateSyntax_urldeencode() : void
72 72
     {
73
-        if($this->isURLEncoded() && $this->getURLDecodeToken() !== null)
73
+        if ($this->isURLEncoded() && $this->getURLDecodeToken() !== null)
74 74
         {
75 75
             $this->validationResult->makeError(
76 76
                 t('Cannot enable URL decoding and encoding at the same time.'),
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowVariable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $tokens = $this->params->getInfo()->getTokens();
48 48
         $allowed = $this->resolveActiveTokens();
49 49
 
50
-        if(count($tokens) > count($allowed))
50
+        if (count($tokens) > count($allowed))
51 51
         {
52 52
             $this->validationResult->makeError(
53 53
                 t('Unknown parameters found:').' '.
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         $allowed = array($this->getVariableToken());
70 70
 
71 71
         $token = $this->getURLEncodeToken();
72
-        if($token)
72
+        if ($token)
73 73
         {
74 74
             $allowed[] = $token;
75 75
         }
76 76
 
77 77
         $token = $this->getURLDecodeToken();
78
-        if($token)
78
+        if ($token)
79 79
         {
80 80
             $allowed[] = $token;
81 81
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/Code.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $lang = $this->params->getInfo()->getStringLiteralByIndex(0);
93 93
 
94
-        if($lang)
94
+        if ($lang)
95 95
         {
96 96
             $this->langToken = $lang;
97 97
             return;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         // To keep PHPStan happy. If no token has been found, this
117 117
         // method will not be called.
118
-        if(!isset($this->langToken))
118
+        if (!isset($this->langToken))
119 119
         {
120 120
             return;
121 121
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $name = $this->langToken->getText();
124 124
         $translator = new Mailcode_Translator();
125 125
 
126
-        if($translator->syntaxExists($name))
126
+        if ($translator->syntaxExists($name))
127 127
         {
128 128
             return;
129 129
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getSyntaxName() : string
148 148
     {
149
-        if(isset($this->langToken))
149
+        if (isset($this->langToken))
150 150
         {
151 151
             return $this->langToken->getText();
152 152
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Normalizer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     
38 38
     public function normalize() : string
39 39
     {
40
-        if(!$this->command->isValid())
40
+        if (!$this->command->isValid())
41 41
         {
42 42
             return '';
43 43
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     
58 58
     private function addType() : void
59 59
     {
60
-        if(!$this->command->supportsType() || !$this->command->hasType())
60
+        if (!$this->command->supportsType() || !$this->command->hasType())
61 61
         {
62 62
             return;
63 63
         }
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
     
68 68
     private function addParams(Mailcode_Commands_Command $command) : void
69 69
     {
70
-        if(!$command->requiresParameters())
70
+        if (!$command->requiresParameters())
71 71
         {
72 72
             return;
73 73
         }
74 74
 
75
-        if($command->hasFreeformParameters())
75
+        if ($command->hasFreeformParameters())
76 76
         {
77 77
             $params = $command->getParams()->getStatementString();
78 78
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $params = $command->getParams()->getNormalized();
82 82
         }
83 83
         
84
-        if(empty($params))
84
+        if (empty($params))
85 85
         {
86 86
             return;
87 87
         }
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
     
93 93
     private function addLogicKeywords() : void
94 94
     {
95
-        if(!$this->command->supportsLogicKeywords())
95
+        if (!$this->command->supportsLogicKeywords())
96 96
         {
97 97
             return;
98 98
         }
99 99
         
100 100
         $keywords = $this->command->getLogicKeywords()->getKeywords();
101 101
         
102
-        foreach($keywords as $keyword)
102
+        foreach ($keywords as $keyword)
103 103
         {
104 104
             $this->parts[] = ' ';
105 105
             $this->parts[] = $keyword->getKeywordString(); // e.g. "if variable"
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Misc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     
35 35
         $this->instantiator->checkCommand($cmd);
36 36
         
37
-        if($cmd instanceof Mailcode_Commands_Command_Comment)
37
+        if ($cmd instanceof Mailcode_Commands_Command_Comment)
38 38
         {
39 39
             return $cmd;
40 40
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         throw $this->instantiator->exceptionUnexpectedType('Comment', $cmd);
43 43
     }
44 44
     
45
-    public function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
45
+    public function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
46 46
     {
47 47
         $sourceVariable = '$'.ltrim($sourceVariable, '$');
48 48
         $loopVariable = '$'.ltrim($loopVariable, '$');
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         
65 65
         $this->instantiator->checkCommand($cmd);
66 66
         
67
-        if($cmd instanceof Mailcode_Commands_Command_For)
67
+        if ($cmd instanceof Mailcode_Commands_Command_For)
68 68
         {
69 69
             return $cmd;
70 70
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         $this->instantiator->checkCommand($cmd);
91 91
 
92
-        if($cmd instanceof Mailcode_Commands_Command_Code)
92
+        if ($cmd instanceof Mailcode_Commands_Command_Code)
93 93
         {
94 94
             return $cmd;
95 95
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/Instantiator.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Factory_Instantiator
22 22
 {
23
-    public function buildIf(string $ifType, string $params, string $type='') : Mailcode_Commands_IfBase
23
+    public function buildIf(string $ifType, string $params, string $type = '') : Mailcode_Commands_IfBase
24 24
     {
25 25
         $stringType = $type;
26 26
         
27
-        if(!empty($type))
27
+        if (!empty($type))
28 28
         {
29 29
             $stringType = ' '.$type;
30 30
         }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         
44 44
         $this->checkCommand($command);
45 45
         
46
-        if($command instanceof Mailcode_Commands_IfBase)
46
+        if ($command instanceof Mailcode_Commands_IfBase)
47 47
         {
48 48
             return $command;
49 49
         }
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
         throw $this->exceptionUnexpectedType('IfBase', $command);
52 52
     }
53 53
     
54
-    public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_IfBase
54
+    public function buildIfVar(string $ifType, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_IfBase
55 55
     {
56
-        if($quoteValue)
56
+        if ($quoteValue)
57 57
         {
58 58
             $value = $this->quoteString($value);
59 59
         }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     * @param bool $caseInsensitive
86 86
     * @return Mailcode_Commands_IfBase
87 87
     */
88
-    public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
88
+    public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
89 89
     {
90 90
         $keyword = ' ';
91 91
         
92
-        if($caseInsensitive)
92
+        if ($caseInsensitive)
93 93
         {
94 94
             $keyword = ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE;
95 95
         }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
         return $this->buildIf($ifType, $condition, 'contains');
105 105
     }
106 106
     
107
-    public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
107
+    public function buildIfBeginsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
108 108
     {
109 109
         return $this->buildIfSearch($ifType, 'begins-with', $variable, $search, $caseInsensitive);
110 110
     }
111 111
     
112
-    public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
112
+    public function buildIfEndsWith(string $ifType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
113 113
     {
114 114
         return $this->buildIfSearch($ifType, 'ends-with', $variable, $search, $caseInsensitive);
115 115
     }
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
         );
160 160
     }
161 161
 
162
-    private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_IfBase
162
+    private function buildIfSearch(string $ifType, string $subType, string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_IfBase
163 163
     {
164 164
         $keyword = ' ';
165 165
         
166
-        if($caseInsensitive)
166
+        if ($caseInsensitive)
167 167
         {
168 168
             $keyword = ' '.Mailcode_Commands_Keywords::TYPE_INSENSITIVE;
169 169
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     
193 193
     public function checkCommand(Mailcode_Commands_Command $command) : void
194 194
     {
195
-        if($command->isValid())
195
+        if ($command->isValid())
196 196
         {
197 197
             return;
198 198
         }
Please login to merge, or discard this patch.
src/Mailcode/Interfaces/Commands/URLDecode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
      * @param bool $decode
13 13
      * @return $this
14 14
      */
15
-    public function setURLDecoding(bool $decode=true);
15
+    public function setURLDecoding(bool $decode = true);
16 16
 }
Please login to merge, or discard this patch.