Passed
Pull Request — master (#20)
by
unknown
09:30
created
src/Mailcode/Date/FormatInfo.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 
149 149
             if (!in_array($char, $this->allowedChars)) {
150 150
                 $result->makeError(
151
-                    t('Invalid character in date format:') . ' ' .
152
-                    t('%1$s at position %2$s.', '<code>' . $char . '</code>', $i + 1),
151
+                    t('Invalid character in date format:').' '.
152
+                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1),
153 153
                     self::VALIDATION_INVALID_FORMAT_CHARACTER
154 154
                 );
155 155
 
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
         $groups = array_keys($grouped);
195 195
 
196 196
         foreach ($groups as $group) {
197
-            usort($grouped[$group], function (Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) {
197
+            usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) {
198 198
                 return strnatcasecmp($a->getChar(), $b->getChar());
199 199
             });
200 200
         }
201 201
 
202
-        uksort($grouped, function (string $a, string $b) {
202
+        uksort($grouped, function(string $a, string $b) {
203 203
             return strnatcasecmp($a, $b);
204 204
         });
205 205
 
Please login to merge, or discard this patch.
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/Collection/Error.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
  */
21 21
 abstract class Mailcode_Collection_Error
22 22
 {
23
-   /**
24
-    * @var integer
25
-    */
23
+    /**
24
+     * @var integer
25
+     */
26 26
     protected int $code = 0;
27 27
 
28
-   /**
29
-    * @var string
30
-    */
28
+    /**
29
+     * @var string
30
+     */
31 31
     protected string $matchedText = '';
32 32
 
33
-   /**
34
-    * @var string
35
-    */
33
+    /**
34
+     * @var string
35
+     */
36 36
     protected string $message = '';
37 37
 
38 38
     protected ?Mailcode_Commands_Command $command = null;
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 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
         Mailcode_Parser_Statement_Tokenizer_Process_SetNames::class,
52 52
     );
53 53
     
54
-   /**
55
-    * @var Mailcode_Parser_Statement
56
-    */
54
+    /**
55
+     * @var Mailcode_Parser_Statement
56
+     */
57 57
     protected Mailcode_Parser_Statement $statement;
58 58
     
59
-   /**
60
-    * @var string
61
-    */
59
+    /**
60
+     * @var string
61
+     */
62 62
     protected string $tokenized = '';
63 63
     
64 64
     /**
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      */
67 67
     protected array $tokensOrdered = array();
68 68
     
69
-   /**
70
-    * @var string[]
71
-    */
69
+    /**
70
+     * @var string[]
71
+     */
72 72
     protected static array $ids = array();
73 73
 
74 74
     /**
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         return $this->statement->getSourceCommand();
92 92
     }
93 93
 
94
-   /**
95
-    * Retrieves all tokens detected in the statement string, in 
96
-    * the order they were found.
97
-    * 
98
-    * @return Mailcode_Parser_Statement_Tokenizer_Token[]
99
-    */
94
+    /**
95
+     * Retrieves all tokens detected in the statement string, in 
96
+     * the order they were found.
97
+     * 
98
+     * @return Mailcode_Parser_Statement_Tokenizer_Token[]
99
+     */
100 100
     public function getTokens() : array
101 101
     {
102 102
         return $this->tokensOrdered;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         return !empty($this->tokensOrdered);
108 108
     }
109 109
     
110
-   /**
111
-    * Whether there were any unknown tokens in the statement.
112
-    * 
113
-    * @return bool
114
-    */
110
+    /**
111
+     * Whether there were any unknown tokens in the statement.
112
+     * 
113
+     * @return bool
114
+     */
115 115
     public function hasUnknown() : bool
116 116
     {
117 117
         $unknown = $this->getUnknown();
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
         return !empty($unknown);
120 120
     }
121 121
     
122
-   /**
123
-    * Retrieves all unknown content tokens, if any.
124
-    * 
125
-    * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
126
-    */
122
+    /**
123
+     * Retrieves all unknown content tokens, if any.
124
+     * 
125
+     * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
126
+     */
127 127
     public function getUnknown() : array
128 128
     {
129 129
         $result = array();
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
         return $this;
411 411
     }
412 412
     
413
-   /**
414
-    * Generates a unique alphabet-based ID without numbers
415
-    * to use as token name, to avoid conflicts with the
416
-    * numbers detection.
417
-    *
418
-    * @return string
419
-    */
413
+    /**
414
+     * Generates a unique alphabet-based ID without numbers
415
+     * to use as token name, to avoid conflicts with the
416
+     * numbers detection.
417
+     *
418
+     * @return string
419
+     */
420 420
     protected function generateID() : string
421 421
     {
422 422
         static $alphas;
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $result = array();
127 127
         
128
-        foreach($this->tokensOrdered as $token)
128
+        foreach ($this->tokensOrdered as $token)
129 129
         {
130
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
130
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
131 131
             {
132 132
                 $result[] = $token;
133 133
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $unknown = $this->getUnknown();
142 142
         
143
-        if(!empty($unknown))
143
+        if (!empty($unknown))
144 144
         {
145 145
             return array_shift($unknown);
146 146
         }
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $parts = array();
154 154
 
155
-        foreach($this->tokensOrdered as $token)
155
+        foreach ($this->tokensOrdered as $token)
156 156
         {
157 157
             $string = $token->getNormalized();
158 158
             
159
-            if($string === '') {
159
+            if ($string === '') {
160 160
                 continue;
161 161
             }
162 162
 
163 163
             // Only add spaces between tokens if they require spacing
164
-            if($token->hasSpacing()) {
164
+            if ($token->hasSpacing()) {
165 165
                 $string .= ' ';
166 166
             }
167 167
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $statement = trim($statement);
188 188
         $tokens = array();
189 189
 
190
-        foreach($this->tokenClasses as $tokenClass)
190
+        foreach ($this->tokenClasses as $tokenClass)
191 191
         {
192 192
             $processor = $this->createProcessor($tokenClass, $statement, $tokens);
193 193
             $processor->process();
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $instance = new $className($this, $statement, $tokens);
213 213
 
214
-        if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
214
+        if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
215 215
         {
216 216
             return $instance;
217 217
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @param mixed $subject
233 233
      * @return Mailcode_Parser_Statement_Tokenizer_Token
234 234
      */
235
-    public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
235
+    public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
236 236
     {
237 237
         $tokenID = $this->generateID();
238 238
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand());
242 242
 
243
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
243
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
244 244
         {
245 245
             return $token;
246 246
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         $token = $this->createToken('Keyword', $name);
271 271
 
272
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
272
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
273 273
         {
274 274
             return $token;
275 275
         }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     {
295 295
         $token = $this->createToken('StringLiteral', SpecialChars::encodeAll($text));
296 296
 
297
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
297
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
298 298
         {
299 299
             return $token;
300 300
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     {
311 311
         $token = $this->createToken('Number', $number);
312 312
 
313
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
313
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
314 314
         {
315 315
             return $token;
316 316
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     public function removeToken(Mailcode_Parser_Statement_Tokenizer_Token $token) : Mailcode_Parser_Statement_Tokenizer
353 353
     {
354 354
         $name = $this->findNameToken($token);
355
-        if($name !== null) {
355
+        if ($name !== null) {
356 356
             $this->removeToken($name);
357 357
         }
358 358
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 
363 363
         foreach ($this->tokensOrdered as $checkToken)
364 364
         {
365
-            if($checkToken->getID() === $tokenID)
365
+            if ($checkToken->getID() === $tokenID)
366 366
             {
367 367
                 $removed = true;
368 368
                 continue;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
         $this->tokensOrdered = $keep;
375 375
 
376
-        if($removed)
376
+        if ($removed)
377 377
         {
378 378
             $this->eventHandler->handleTokenRemoved($token);
379 379
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     {
419 419
         static $alphas;
420 420
 
421
-        if(!isset($alphas))
421
+        if (!isset($alphas))
422 422
         {
423 423
             $alphas = range('A', 'Z');
424 424
         }
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 
428 428
         $result = '';
429 429
 
430
-        for($i=0; $i < $amount; $i++)
430
+        for ($i = 0; $i < $amount; $i++)
431 431
         {
432 432
             $result .= $alphas[array_rand($alphas)];
433 433
         }
434 434
 
435
-        if(!in_array($result, self::$ids))
435
+        if (!in_array($result, self::$ids))
436 436
         {
437 437
             self::$ids[] = $result;
438 438
             return $result;
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
     {
469 469
         $targetID = $targetToken->getID();
470 470
 
471
-        foreach($this->tokensOrdered as $idx => $token)
471
+        foreach ($this->tokensOrdered as $idx => $token)
472 472
         {
473
-            if($token->getID() === $targetID)
473
+            if ($token->getID() === $targetID)
474 474
             {
475
-                $prev = $this->tokensOrdered[$idx-1] ?? null;
476
-                if($prev instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName)
475
+                $prev = $this->tokensOrdered[$idx - 1] ?? null;
476
+                if ($prev instanceof Mailcode_Parser_Statement_Tokenizer_Token_ParamName)
477 477
                 {
478 478
                     return $prev;
479 479
                 }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
     public function injectParamName(Mailcode_Parser_Statement_Tokenizer_Token $targetToken, string $name) : Mailcode_Parser_Statement_Tokenizer_Token_ParamName
498 498
     {
499 499
         $existing = $this->findNameToken($targetToken);
500
-        if($existing) {
500
+        if ($existing) {
501 501
             $this->removeToken($existing);
502 502
         }
503 503
 
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
         $tokens = array();
519 519
         $found = false;
520 520
 
521
-        foreach($this->tokensOrdered as $token)
521
+        foreach ($this->tokensOrdered as $token)
522 522
         {
523
-            if($token->getID() === $targetID)
523
+            if ($token->getID() === $targetID)
524 524
             {
525 525
                 $tokens[] = $newToken;
526 526
                 $found = true;
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
             $tokens[] = $token;
530 530
         }
531 531
 
532
-        if($found) {
532
+        if ($found) {
533 533
             $this->tokensOrdered = $tokens;
534 534
 
535 535
             return $this;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/StringLiteral.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
     /**
38
-    * Retrieves the text with the surrounding quotes,
39
-    * and special characters escaped for Mailcode.
40
-    *
41
-    * @return string
42
-    */
38
+     * Retrieves the text with the surrounding quotes,
39
+     * and special characters escaped for Mailcode.
40
+     *
41
+     * @return string
42
+     */
43 43
     public function getNormalized() : string
44 44
     {
45 45
         return '"'.SpecialChars::escape($this->text).'"';
@@ -50,21 +50,21 @@  discard block
 block discarded – undo
50 50
         return true;
51 51
     }
52 52
     
53
-   /**
54
-    * Retrieves the text with the surrounding quotes.
55
-    * @return string
56
-    */
53
+    /**
54
+     * Retrieves the text with the surrounding quotes.
55
+     * @return string
56
+     */
57 57
     public function getValue() : string
58 58
     {
59 59
         return $this->getNormalized();
60 60
     }
61 61
     
62
-   /**
63
-    * Retrieves the text without the surrounding quotes,
64
-    * and special Mailcode characters not escaped.
65
-    *
66
-    * @return string
67
-    */
62
+    /**
63
+     * Retrieves the text without the surrounding quotes,
64
+     * and special Mailcode characters not escaped.
65
+     *
66
+     * @return string
67
+     */
68 68
     public function getText() : string
69 69
     {
70 70
         return SpecialChars::decode($this->text);
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/Operand.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
         return true;
36 36
     }
37 37
     
38
-   /**
39
-    * Retrieves all known comparison operator signs.
40
-    * @return string[]
41
-    */
38
+    /**
39
+     * Retrieves all known comparison operator signs.
40
+     * @return string[]
41
+     */
42 42
     public static function getComparisonSigns() : array
43 43
     {
44 44
         return array(
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
         );
52 52
     }
53 53
     
54
-   /**
55
-    * Retrieves all known arithmetic operator signs.
56
-    * @return string[]
57
-    */
54
+    /**
55
+     * Retrieves all known arithmetic operator signs.
56
+     * @return string[]
57
+     */
58 58
     public static function getArithmeticSigns() : array
59 59
     {
60 60
         return array(
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
         );
66 66
     }
67 67
     
68
-   /**
69
-    * Whether the operator is comparison related (equals, not equals, smaller, greater...).
70
-    *  
71
-    * @return bool
72
-    */
68
+    /**
69
+     * Whether the operator is comparison related (equals, not equals, smaller, greater...).
70
+     *  
71
+     * @return bool
72
+     */
73 73
     public function isComparator() : bool
74 74
     {
75 75
         return 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         $this->isSmallerOrEquals();
82 82
     }
83 83
     
84
-   /**
85
-    * Whether the operator is calculation related (minus, plus, divide, multiply).
86
-    * 
87
-    * @return bool
88
-    */
84
+    /**
85
+     * Whether the operator is calculation related (minus, plus, divide, multiply).
86
+     * 
87
+     * @return bool
88
+     */
89 89
     public function isCalculator() : bool
90 90
     {
91 91
         return 
Please login to merge, or discard this patch.