Passed
Push — master ( 0f91e9...e0eb75 )
by Sebastian
03:48
created
src/Mailcode/Parser/Statement/Tokenizer.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $result = array();
121 121
         
122
-        foreach($this->tokensOrdered as $token)
122
+        foreach ($this->tokensOrdered as $token)
123 123
         {
124
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
124
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Unknown)
125 125
             {
126 126
                 $result[] = $token;
127 127
             }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $unknown = $this->getUnknown();
136 136
         
137
-        if(!empty($unknown))
137
+        if (!empty($unknown))
138 138
         {
139 139
             return array_shift($unknown);
140 140
         }
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $parts = array();
148 148
 
149
-        foreach($this->tokensOrdered as $token)
149
+        foreach ($this->tokensOrdered as $token)
150 150
         {
151 151
             $string = $token->getNormalized();
152 152
             
153
-            if($string !== '')
153
+            if ($string !== '')
154 154
             {
155 155
                 $parts[] = $string;
156 156
             }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $statement = trim($statement);
176 176
         $tokens = array();
177 177
 
178
-        foreach($this->tokenClasses as $tokenClass)
178
+        foreach ($this->tokenClasses as $tokenClass)
179 179
         {
180 180
             $processor = $this->createProcessor($tokenClass, $statement, $tokens);
181 181
             $processor->process();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         $instance = new $className($this, $statement, $tokens);
201 201
 
202
-        if($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
202
+        if ($instance instanceof Mailcode_Parser_Statement_Tokenizer_Process)
203 203
         {
204 204
             return $instance;
205 205
         }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @param mixed $subject
221 221
      * @return Mailcode_Parser_Statement_Tokenizer_Token
222 222
      */
223
-    public function createToken(string $type, string $matchedText, $subject=null) : Mailcode_Parser_Statement_Tokenizer_Token
223
+    public function createToken(string $type, string $matchedText, $subject = null) : Mailcode_Parser_Statement_Tokenizer_Token
224 224
     {
225 225
         $tokenID = $this->generateID();
226 226
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
         $token = new $class($tokenID, $matchedText, $subject, $this->getSourceCommand());
230 230
 
231
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
231
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token)
232 232
         {
233 233
             return $token;
234 234
         }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         $token = $this->createToken('Keyword', $name);
251 251
 
252
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
252
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
253 253
         {
254 254
             return $token;
255 255
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     {
275 275
         $token = $this->createToken('StringLiteral', SpecialChars::encodeAll($text));
276 276
 
277
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
277
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
278 278
         {
279 279
             return $token;
280 280
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
         foreach ($this->tokensOrdered as $checkToken)
314 314
         {
315
-            if($checkToken->getID() === $tokenID)
315
+            if ($checkToken->getID() === $tokenID)
316 316
             {
317 317
                 $removed = true;
318 318
                 continue;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
         $this->tokensOrdered = $keep;
325 325
 
326
-        if($removed)
326
+        if ($removed)
327 327
         {
328 328
             $this->eventHandler->handleTokenRemoved($token);
329 329
         }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     {
369 369
         static $alphas;
370 370
 
371
-        if(!isset($alphas))
371
+        if (!isset($alphas))
372 372
         {
373 373
             $alphas = range('A', 'Z');
374 374
         }
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
         $result = '';
379 379
 
380
-        for($i=0; $i < $amount; $i++)
380
+        for ($i = 0; $i < $amount; $i++)
381 381
         {
382 382
             $result .= $alphas[array_rand($alphas)];
383 383
         }
384 384
 
385
-        if(!in_array($result, self::$ids))
385
+        if (!in_array($result, self::$ids))
386 386
         {
387 387
             self::$ids[] = $result;
388 388
             return $result;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Info.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $token = $this->getTokenByIndex($index);
106 106
         
107
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
107
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
108 108
         {
109 109
             return $token;
110 110
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $token = $this->getTokenByIndex($index);
139 139
         
140
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
140
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
141 141
         {
142 142
             return $token;
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $tokens = $this->tokenizer->getTokens();
159 159
 
160
-        if(isset($tokens[$index]))
160
+        if (isset($tokens[$index]))
161 161
         {
162 162
             return $tokens[$index];
163 163
         }
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
         $result = array();
191 191
         $tokens = $this->tokenizer->getTokens();
192 192
         
193
-        foreach($tokens as $token)
193
+        foreach ($tokens as $token)
194 194
         {
195
-            if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
195
+            if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral)
196 196
             {
197 197
                 $result[] = $token;
198 198
             }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/EventHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
     private function addListener(string $eventName, callable $listener) : void
154 154
     {
155
-        if(!isset($this->listeners[$eventName]))
155
+        if (!isset($this->listeners[$eventName]))
156 156
         {
157 157
             $this->listeners[$eventName] = array();
158 158
         }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     {
197 197
         $this->triggerEvent(self::EVENT_TOKEN_REMOVED, $token);
198 198
 
199
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
199
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
200 200
         {
201 201
             $this->triggerKeywordRemoved($token->getKeyword());
202 202
         }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $this->triggerEvent(self::EVENT_TOKEN_ADDED, $token);
224 224
 
225
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
225
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword)
226 226
         {
227 227
             $this->triggerKeywordAdded($token->getKeyword());
228 228
         }
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
      */
262 262
     private function triggerEvent(string $eventName, ...$listenerArgs) : void
263 263
     {
264
-        if(!isset($this->listeners[$eventName]))
264
+        if (!isset($this->listeners[$eventName]))
265 265
         {
266 266
             return;
267 267
         }
268 268
 
269
-        foreach($this->listeners[$eventName] as $listener)
269
+        foreach ($this->listeners[$eventName] as $listener)
270 270
         {
271 271
             $listener($this->tokenizer, ...$listenerArgs);
272 272
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/TrackingIDTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $token = $this->getTrackingIDToken();
47 47
 
48
-        if($token === null)
48
+        if ($token === null)
49 49
         {
50 50
             return '';
51 51
         }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     private function filterTrackingID(string $trackingID) : string
60 60
     {
61
-        if(empty($trackingID))
61
+        if (empty($trackingID))
62 62
         {
63 63
             return AutoTrackingID::generate($this);
64 64
         }
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 
76 76
     private function initTrackingToken() : void
77 77
     {
78
-        if(!$this->isTrackingEnabled())
78
+        if (!$this->isTrackingEnabled())
79 79
         {
80 80
             $this->clearTrackingIDToken();
81 81
             return;
82 82
         }
83 83
 
84
-        if(isset($this->trackingIDToken))
84
+        if (isset($this->trackingIDToken))
85 85
         {
86 86
             return;
87 87
         }
88 88
 
89 89
         $token = $this->detectToken();
90
-        if($token === null)
90
+        if ($token === null)
91 91
         {
92 92
             $token = $this->requireParams()
93 93
                 ->getInfo()
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $this->trackingIDToken = null;
103 103
 
104 104
         $token = $this->detectToken();
105
-        if($token !== null)
105
+        if ($token !== null)
106 106
         {
107 107
             $this->requireParams()
108 108
                 ->getInfo()
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $token = $this->getTrackingIDToken();
116 116
 
117
-        if($token !== null)
117
+        if ($token !== null)
118 118
         {
119 119
             $token->setText($this->filterTrackingID($trackingID));
120 120
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             ->getInfo()
129 129
             ->getStringLiterals();
130 130
 
131
-        if(empty($literals))
131
+        if (empty($literals))
132 132
         {
133 133
             return null;
134 134
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
         $id = $trackingID->getText();
139 139
 
140
-        if(strpos($id, '=') === false)
140
+        if (strpos($id, '=') === false)
141 141
         {
142 142
             return $trackingID;
143 143
         }
Please login to merge, or discard this patch.