Passed
Pull Request — master (#15)
by Sebastian
04:12
created
src/Mailcode/Collection/Error/Message.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Collection_Error_Message extends Mailcode_Collection_Error
22 22
 {
23
-    public function __construct(string $matchedText, int $code, string $message, ?object $subject=null)
23
+    public function __construct(string $matchedText, int $code, string $message, ?object $subject = null)
24 24
     {
25 25
         $this->matchedText = $matchedText;
26 26
         $this->code = $code;
27 27
         $this->message = $message;
28 28
 
29
-        if($subject instanceof Mailcode_Commands_Command)
29
+        if ($subject instanceof Mailcode_Commands_Command)
30 30
         {
31 31
             $this->command = $subject;
32 32
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Set.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 $value = $this->instantiator->quoteString($value);
41 41
             }
42 42
 
43
-            $params = $variableName . ' = ' . $value;
43
+            $params = $variableName.' = '.$value;
44 44
         }
45 45
 
46 46
         $cmd = $this->commands->createCommand(
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Variables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         return $this->variables->createVariableByName($fullName);
31 31
     }
32 32
 
33
-    public function pathName(string $path, ?string $name=null) : Mailcode_Variables_Variable
33
+    public function pathName(string $path, ?string $name = null) : Mailcode_Variables_Variable
34 34
     {
35 35
         return $this->variables->createVariable($path, $name);
36 36
     }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
28 28
     private ?Mailcode_Factory_CommandSets_Set_Variables $variables = null;
29 29
 
30
-    public function if() : Mailcode_Factory_CommandSets_Set_If
30
+    public function if () : Mailcode_Factory_CommandSets_Set_If
31 31
     {
32
-        if(!isset($this->if))
32
+        if (!isset($this->if))
33 33
         {
34 34
             $this->if = new Mailcode_Factory_CommandSets_Set_If();
35 35
         }
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
         return $this->if;
38 38
     }
39 39
     
40
-    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
40
+    public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
41 41
     {
42
-        if(!isset($this->elseIf))
42
+        if (!isset($this->elseIf))
43 43
         {
44 44
             $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
45 45
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     
50 50
     public function show() : Mailcode_Factory_CommandSets_Set_Show
51 51
     {
52
-        if(!isset($this->show))
52
+        if (!isset($this->show))
53 53
         {
54 54
             $this->show = new Mailcode_Factory_CommandSets_Set_Show();
55 55
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     
60 60
     public function misc() : Mailcode_Factory_CommandSets_Set_Misc
61 61
     {
62
-        if(!isset($this->misc))
62
+        if (!isset($this->misc))
63 63
         {
64 64
             $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
65 65
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     
70 70
     public function set() : Mailcode_Factory_CommandSets_Set_Set
71 71
     {
72
-        if(!isset($this->set))
72
+        if (!isset($this->set))
73 73
         {
74 74
             $this->set = new Mailcode_Factory_CommandSets_Set_Set();
75 75
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function var() : Mailcode_Factory_CommandSets_Set_Variables
81 81
     {
82
-        if(!isset($this->variables))
82
+        if (!isset($this->variables))
83 83
         {
84 84
             $this->variables = new Mailcode_Factory_CommandSets_Set_Variables();
85 85
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $result = array();
130 130
         
131
-        foreach($this->tokensOrdered as $token)
131
+        foreach ($this->tokensOrdered as $token)
132 132
         {
133
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
133
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
134 134
             {
135 135
                 $result[] = $token;
136 136
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $unknown = $this->getUnknown();
145 145
         
146
-        if(!empty($unknown))
146
+        if (!empty($unknown))
147 147
         {
148 148
             return array_shift($unknown);
149 149
         }
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $parts = array();
157 157
 
158
-        foreach($this->tokensOrdered as $token)
158
+        foreach ($this->tokensOrdered as $token)
159 159
         {
160 160
             $string = $token->getNormalized();
161 161
             
162
-            if($string === '') {
162
+            if ($string === '') {
163 163
                 continue;
164 164
             }
165 165
 
166 166
             // Only add spaces between tokens if they require spacing
167
-            if($token->hasSpacing()) {
167
+            if ($token->hasSpacing()) {
168 168
                 $string .= ' ';
169 169
             }
170 170
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $statement = trim($statement);
191 191
         $tokens = array();
192 192
 
193
-        foreach($this->tokenClasses as $tokenClass)
193
+        foreach ($this->tokenClasses as $tokenClass)
194 194
         {
195 195
             $processor = $this->createProcessor($tokenClass, $statement, $tokens);
196 196
             $processor->process();
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $instance = new $className($this, $statement, $tokens);
216 216
 
217
-        if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
217
+        if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
218 218
         {
219 219
             return $instance;
220 220
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param mixed $subject
236 236
      * @return Mailcode_Parser_Statement_Tokenizer_Token
237 237
      */
238
-    public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
238
+    public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
239 239
     {
240 240
         $tokenID = $this->generateID();
241 241
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
         $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand());
245 245
 
246
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
246
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
247 247
         {
248 248
             return $token;
249 249
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $token = $this->createToken('Keyword', $name);
274 274
 
275
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
275
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
276 276
         {
277 277
             return $token;
278 278
         }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     {
298 298
         $token = $this->createToken('StringLiteral', SpecialChars::encodeAll($text));
299 299
 
300
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
300
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
301 301
         {
302 302
             return $token;
303 303
         }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $token = $this->createToken('Number', $number);
315 315
 
316
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
316
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
317 317
         {
318 318
             return $token;
319 319
         }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     public function removeToken(Mailcode_Parser_Statement_Tokenizer_Token $token) : Mailcode_Parser_Statement_Tokenizer
356 356
     {
357 357
         $name = $this->findNameToken($token);
358
-        if($name !== null) {
358
+        if ($name !== null) {
359 359
             $this->removeToken($name);
360 360
         }
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         foreach ($this->tokensOrdered as $checkToken)
367 367
         {
368
-            if($checkToken->getID() === $tokenID)
368
+            if ($checkToken->getID() === $tokenID)
369 369
             {
370 370
                 $removed = true;
371 371
                 continue;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
         $this->tokensOrdered = $keep;
378 378
 
379
-        if($removed)
379
+        if ($removed)
380 380
         {
381 381
             $this->eventHandler->handleTokenRemoved($token);
382 382
         }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     {
422 422
         static $alphas;
423 423
 
424
-        if(!isset($alphas))
424
+        if (!isset($alphas))
425 425
         {
426 426
             $alphas = range('A', 'Z');
427 427
         }
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
 
431 431
         $result = '';
432 432
 
433
-        for($i=0; $i < $amount; $i++)
433
+        for ($i = 0; $i < $amount; $i++)
434 434
         {
435 435
             $result .= $alphas[array_rand($alphas)];
436 436
         }
437 437
 
438
-        if(!in_array($result, self::$ids))
438
+        if (!in_array($result, self::$ids))
439 439
         {
440 440
             self::$ids[] = $result;
441 441
             return $result;
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
     {
472 472
         $targetID = $targetToken->getID();
473 473
 
474
-        foreach($this->tokensOrdered as $idx => $token)
474
+        foreach ($this->tokensOrdered as $idx => $token)
475 475
         {
476
-            if($token->getID() === $targetID)
476
+            if ($token->getID() === $targetID)
477 477
             {
478
-                $prev = $this->tokensOrdered[$idx-1] ?? null;
479
-                if($prev instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName)
478
+                $prev = $this->tokensOrdered[$idx - 1] ?? null;
479
+                if ($prev instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName)
480 480
                 {
481 481
                     return $prev;
482 482
                 }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     public function injectParamName(Mailcode_Parser_Statement_Tokenizer_Token $targetToken, string $name) : Mailcode_Parser_Statement_Tokenizer_Token_ParamName
501 501
     {
502 502
         $existing = $this->findNameToken($targetToken);
503
-        if($existing) {
503
+        if ($existing) {
504 504
             $this->removeToken($existing);
505 505
         }
506 506
 
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
         $tokens = array();
522 522
         $found = false;
523 523
 
524
-        foreach($this->tokensOrdered as $token)
524
+        foreach ($this->tokensOrdered as $token)
525 525
         {
526
-            if($token->getID() === $targetID)
526
+            if ($token->getID() === $targetID)
527 527
             {
528 528
                 $tokens[] = $newToken;
529 529
                 $found = true;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             $tokens[] = $token;
533 533
         }
534 534
 
535
-        if($found) {
535
+        if ($found) {
536 536
             $this->tokensOrdered = $tokens;
537 537
 
538 538
             return $this;
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
         echo 'Statement: ['.$this->getNormalized().']'.PHP_EOL;
556 556
         echo 'Tokens:'.PHP_EOL;
557 557
 
558
-        foreach($this->tokensOrdered as $idx => $token)
558
+        foreach ($this->tokensOrdered as $idx => $token)
559 559
         {
560 560
             echo '- #'.$idx.' '.$token->getID().''.PHP_EOL;
561 561
             echo '     Type: '.$token->getTypeID().PHP_EOL;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -313,9 +313,9 @@
 block discarded – undo
313 313
     {
314 314
         $tokens = $this->tokenizer->getTokens();
315 315
 
316
-        foreach($tokens as $token)
316
+        foreach ($tokens as $token)
317 317
         {
318
-            if($token->getName() === $name)
318
+            if ($token->getName() === $name)
319 319
             {
320 320
                 return $token;
321 321
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param mixed $subject
37 37
      * @param Mailcode_Commands_Command|null $sourceCommand
38 38
      */
39
-    public function __construct(string $tokenID, string $matchedText, $subject=null, ?Mailcode_Commands_Command $sourceCommand=null)
39
+    public function __construct(string $tokenID, string $matchedText, $subject = null, ?Mailcode_Commands_Command $sourceCommand = null)
40 40
     {
41 41
         $this->tokenID = $tokenID;
42 42
         $this->matchedText = $matchedText;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function getName() : string
65 65
     {
66
-        if(isset($this->nameToken)) {
66
+        if (isset($this->nameToken)) {
67 67
             return $this->nameToken->getParamName();
68 68
         }
69 69
 
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Process/SetNames.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         {
13 13
             $next = $this->tokensTemporary[$i + 1] ?? null;
14 14
 
15
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName && $next) {
15
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName && $next) {
16 16
                 $next->registerNameToken($token);
17 17
             }
18 18
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Process/NamedParameters.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
         $matches = array();
12 12
         preg_match_all('/([a-z][a-z0-9-]+)\s*=/iU', $this->tokenized, $matches, PREG_PATTERN_ORDER);
13 13
 
14
-        foreach($matches[0] as $match)
14
+        foreach ($matches[0] as $match)
15 15
         {
16 16
             $this->registerToken('ParamName', $match);
17 17
         }
Please login to merge, or discard this patch.