Passed
Push — master ( af11e6...9ff364 )
by Sebastian
03:46
created
src/Mailcode.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     */
78 78
     public function getParser() : Mailcode_Parser
79 79
     {
80
-        if(!isset($this->parser)) 
80
+        if (!isset($this->parser)) 
81 81
         {
82 82
             $this->parser = new Mailcode_Parser($this);
83 83
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     */
94 94
     public function getCommands() : Mailcode_Commands
95 95
     {
96
-        if(!isset($this->commands)) 
96
+        if (!isset($this->commands)) 
97 97
         {
98 98
             $this->commands = new Mailcode_Commands();
99 99
         }
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
      * @param Mailcode_Commands_Command|null $sourceCommand
119 119
      * @return Mailcode_Variables_Collection_Regular
120 120
      */
121
-    public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Variables_Collection_Regular
121
+    public function findVariables(string $subject, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Variables_Collection_Regular
122 122
     {
123 123
         return $this->createVariables()->parseString($subject, $sourceCommand);
124 124
     }
125 125
     
126 126
     public function createVariables() : Mailcode_Variables
127 127
     {
128
-        if(!isset($this->variables))
128
+        if (!isset($this->variables))
129 129
         {
130 130
             $this->variables = new Mailcode_Variables();
131 131
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     */
142 142
     public function createTranslator() : Mailcode_Translator
143 143
     {
144
-        if(!isset($this->translator))
144
+        if (!isset($this->translator))
145 145
         {
146 146
             $this->translator = new Mailcode_Translator(); 
147 147
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         return self::$logger;
190 190
     }
191 191
 
192
-    public static function setDebugging(bool $enabled=true) : void
192
+    public static function setDebugging(bool $enabled = true) : void
193 193
     {
194 194
         self::$debug = $enabled;
195 195
     }
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
      * @param array<string|int,mixed> $context
205 205
      * @return void
206 206
      */
207
-    public static function debug(string $message, array $context=array()) : void
207
+    public static function debug(string $message, array $context = array()) : void
208 208
     {
209
-        if(self::$debug && isset(self::$logger))
209
+        if (self::$debug && isset(self::$logger))
210 210
         {
211 211
             self::$logger->debug($message, $context);
212 212
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowURL/AutoTrackingID.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $instanceID = $command->getInstanceID();
50 50
 
51
-        if(isset(self::$generated[$instanceID]))
51
+        if (isset(self::$generated[$instanceID]))
52 52
         {
53 53
             return self::$generated[$instanceID];
54 54
         }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 
86 86
     private static function generateIDString(TrackingIDInterface $command) : string
87 87
     {
88
-        if(isset(self::$customGenerator))
88
+        if (isset(self::$customGenerator))
89 89
         {
90 90
             $result = call_user_func(self::$customGenerator, $command);
91 91
 
92
-            if(is_string($result))
92
+            if (is_string($result))
93 93
             {
94 94
                 return $result;
95 95
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     private int $instanceID;
133 133
 
134
-    public function __construct(string $type='', string $paramsString='', string $matchedText='')
134
+    public function __construct(string $type = '', string $paramsString = '', string $matchedText = '')
135 135
     {
136 136
         self::$instanceCounter++;
137 137
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $this->requireNonDummy();
224 224
         
225
-        if($this->hash === '') {
225
+        if ($this->hash === '') {
226 226
             $this->hash = md5($this->matchedText);
227 227
         }
228 228
         
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     
232 232
     protected function requireNonDummy() : void
233 233
     {
234
-        if(!$this->isDummy())
234
+        if (!$this->isDummy())
235 235
         {
236 236
             return;
237 237
         }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     
251 251
     protected function validate() : OperationResult
252 252
     {
253
-        if(!$this->validated)
253
+        if (!$this->validated)
254 254
         {
255 255
             $this->requireNonDummy();
256 256
             $this->validateSyntax();
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
     {
271 271
         $validations = $this->resolveValidations();
272 272
 
273
-        foreach($validations as $validation)
273
+        foreach ($validations as $validation)
274 274
         {
275 275
             // break off at the first validation issue
276
-            if(!$this->validateSyntaxMethod($validation))
276
+            if (!$this->validateSyntaxMethod($validation))
277 277
             {
278 278
                 return;
279 279
             }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     {
293 293
         $method = 'validateSyntax_'.$validation;
294 294
         
295
-        if(!method_exists($this, $method))
295
+        if (!method_exists($this, $method))
296 296
         {
297 297
             throw new Mailcode_Exception(
298 298
                 'Missing validation method ['.$validation.']',
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
     public function validateNesting() : OperationResult
324 324
     {
325
-        if($this->nestingValidated)
325
+        if ($this->nestingValidated)
326 326
         {
327 327
             return $this->validationResult;
328 328
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     
347 347
     public function getType() : string
348 348
     {
349
-        if($this->supportsType())
349
+        if ($this->supportsType())
350 350
         {
351 351
             return $this->type;
352 352
         }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     
367 367
     public function getHighlighted() : string
368 368
     {
369
-        if(!$this->isValid())
369
+        if (!$this->isValid())
370 370
         {
371 371
             return '';
372 372
         }
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     
378 378
     public function getParamsString() : string
379 379
     {
380
-        if($this->requiresParameters())
380
+        if ($this->requiresParameters())
381 381
         {
382 382
             return $this->paramsString;
383 383
         }
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
     public function requireParams() : Mailcode_Parser_Statement
394 394
     {
395
-        if(isset($this->params))
395
+        if (isset($this->params))
396 396
         {
397 397
             return $this->params;
398 398
         }
@@ -422,22 +422,22 @@  discard block
 block discarded – undo
422 422
     
423 423
     public final function getCommandType() : string
424 424
     {
425
-        if($this instanceof Mailcode_Commands_Command_Type_Closing)
425
+        if ($this instanceof Mailcode_Commands_Command_Type_Closing)
426 426
         {
427 427
             return 'Closing';
428 428
         }
429 429
         
430
-        if($this instanceof Mailcode_Commands_Command_Type_Opening)
430
+        if ($this instanceof Mailcode_Commands_Command_Type_Opening)
431 431
         {
432 432
             return 'Opening';
433 433
         }
434 434
         
435
-        if($this instanceof Mailcode_Commands_Command_Type_Sibling)
435
+        if ($this instanceof Mailcode_Commands_Command_Type_Sibling)
436 436
         {
437 437
             return 'Sibling';
438 438
         }
439 439
         
440
-        if($this instanceof Mailcode_Commands_Command_Type_Standalone)
440
+        if ($this instanceof Mailcode_Commands_Command_Type_Standalone)
441 441
         {
442 442
             return 'Standalone';
443 443
         }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
     
475 475
     public function getLogicKeywords() : Mailcode_Commands_LogicKeywords
476 476
     {
477
-        if(isset($this->logicKeywords) && $this->supportsLogicKeywords())
477
+        if (isset($this->logicKeywords) && $this->supportsLogicKeywords())
478 478
         {
479 479
             return $this->logicKeywords;
480 480
         }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
     public function getTranslationParam(string $name)
496 496
     {
497
-        if(isset($this->translationParams[$name]))
497
+        if (isset($this->translationParams[$name]))
498 498
         {
499 499
             return $this->translationParams[$name];
500 500
         }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
         return null;
503 503
     }
504 504
 
505
-    public function setURLEncoding(bool $encoding=true)
505
+    public function setURLEncoding(bool $encoding = true)
506 506
     {
507 507
         $this->requireURLEncoding();
508 508
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         return $this;
514 514
     }
515 515
 
516
-    public function setURLDecoding(bool $decode=true)
516
+    public function setURLDecoding(bool $decode = true)
517 517
     {
518 518
         $this->requireURLEncoding();
519 519
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
     protected function requireURLEncoding() : void
528 528
     {
529
-        if($this->supportsURLEncoding()) {
529
+        if ($this->supportsURLEncoding()) {
530 530
             return;
531 531
         }
532 532
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
     protected function getValidator() : Mailcode_Parser_Statement_Validator
554 554
     {
555
-        if(isset($this->validator))
555
+        if (isset($this->validator))
556 556
         {
557 557
             return $this->validator;
558 558
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Show.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         
36 36
         $this->instantiator->checkCommand($cmd);
37 37
         
38
-        if($cmd instanceof Mailcode_Commands_Command_ShowVariable)
38
+        if ($cmd instanceof Mailcode_Commands_Command_ShowVariable)
39 39
         {
40 40
             return $cmd;
41 41
         }
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
         throw $this->instantiator->exceptionUnexpectedType('ShowVariable', $cmd);
44 44
     }
45 45
     
46
-    public function date(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate
46
+    public function date(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate
47 47
     {
48 48
         $variableName = $this->instantiator->filterVariableName($variableName);
49 49
         
50 50
         $format = '';
51
-        if(!empty($formatString))
51
+        if (!empty($formatString))
52 52
         {
53 53
             $format = sprintf(
54 54
                 ' "%s"',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         
70 70
         $this->instantiator->checkCommand($cmd);
71 71
         
72
-        if($cmd instanceof Mailcode_Commands_Command_ShowDate)
72
+        if ($cmd instanceof Mailcode_Commands_Command_ShowDate)
73 73
         {
74 74
             return $cmd;
75 75
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         throw $this->instantiator->exceptionUnexpectedType('ShowDate', $cmd);
78 78
     }
79 79
 
80
-    public function number(string $variableName, string $formatString="", bool $absolute=false) : Mailcode_Commands_Command_ShowNumber
80
+    public function number(string $variableName, string $formatString = "", bool $absolute = false) : Mailcode_Commands_Command_ShowNumber
81 81
     {
82 82
         $variableName = $this->instantiator->filterVariableName($variableName);
83 83
         $paramsString = $this->compileNumberParams($formatString, $absolute);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         $this->instantiator->checkCommand($cmd);
97 97
 
98
-        if($cmd instanceof Mailcode_Commands_Command_ShowNumber)
98
+        if ($cmd instanceof Mailcode_Commands_Command_ShowNumber)
99 99
         {
100 100
             return $cmd;
101 101
         }
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
         throw $this->instantiator->exceptionUnexpectedType('ShowNumber', $cmd);
104 104
     }
105 105
 
106
-    private function compileNumberParams(string $formatString="", bool $absolute=false) : string
106
+    private function compileNumberParams(string $formatString = "", bool $absolute = false) : string
107 107
     {
108 108
         $params = array();
109 109
 
110
-        if(!empty($formatString))
110
+        if (!empty($formatString))
111 111
         {
112 112
             $params[] = sprintf(
113 113
                 ' "%s"',
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
             );
116 116
         }
117 117
 
118
-        if($absolute)
118
+        if ($absolute)
119 119
         {
120 120
             $params[] = ' absolute:';
121 121
         }
122 122
 
123
-        if(!empty($params))
123
+        if (!empty($params))
124 124
         {
125 125
             return ' '.implode(' ', $params);
126 126
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @throws Mailcode_Exception
139 139
      * @throws Mailcode_Factory_Exception
140 140
      */
141
-    public function phone(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone
141
+    public function phone(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone
142 142
     {
143 143
         $variableName = $this->instantiator->filterVariableName($variableName);
144 144
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $this->instantiator->checkCommand($cmd);
162 162
         $this->instantiator->setEncoding($cmd, $urlEncoding);
163 163
 
164
-        if($cmd instanceof Mailcode_Commands_Command_ShowPhone)
164
+        if ($cmd instanceof Mailcode_Commands_Command_ShowPhone)
165 165
         {
166 166
             return $cmd;
167 167
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         
183 183
         $this->instantiator->checkCommand($cmd);
184 184
         
185
-        if($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
185
+        if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet)
186 186
         {
187 187
             return $cmd;
188 188
         }
@@ -198,21 +198,21 @@  discard block
 block discarded – undo
198 198
      * @throws Mailcode_Exception
199 199
      * @throws Mailcode_Factory_Exception
200 200
      */
201
-    public function url(string $url, ?string $trackingID=null, array $queryParams=array()) : Mailcode_Commands_Command_ShowURL
201
+    public function url(string $url, ?string $trackingID = null, array $queryParams = array()) : Mailcode_Commands_Command_ShowURL
202 202
     {
203 203
         $contentID = PreParser::storeContent($url);
204 204
 
205 205
         $params = array();
206 206
         $params[] = (string)$contentID;
207 207
 
208
-        if($trackingID !== null)
208
+        if ($trackingID !== null)
209 209
         {
210 210
             $params[] = sprintf('"%s"', $trackingID);
211 211
         }
212 212
 
213
-        if(!empty($queryParams))
213
+        if (!empty($queryParams))
214 214
         {
215
-            foreach($queryParams as $name => $value)
215
+            foreach ($queryParams as $name => $value)
216 216
             {
217 217
                 $params[] = sprintf(
218 218
                     '"%s=%s"',
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         $this->instantiator->checkCommand($cmd);
235 235
 
236
-        if($cmd instanceof Mailcode_Commands_Command_ShowURL)
236
+        if ($cmd instanceof Mailcode_Commands_Command_ShowURL)
237 237
         {
238 238
             return $cmd;
239 239
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         $result = new ParseResult($collection, $preParser);
74 74
 
75
-        if(!$collection->isValid())
75
+        if (!$collection->isValid())
76 76
         {
77 77
             return $result;
78 78
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         
85 85
         $total = count($matches[0]);
86 86
 
87
-        for($i=0; $i < $total; $i++)
87
+        for ($i = 0; $i < $total; $i++)
88 88
         {
89 89
             $match = $this->parseMatch($matches, $i);
90 90
             
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
     private function handleNesting(Mailcode_Commands_Command $cmd) : void
155 155
     {
156 156
         // Set the command's parent from the stack, if any is present.
157
-        if(!empty($this->stack))
157
+        if (!empty($this->stack))
158 158
         {
159 159
             $cmd->setParent($this->getStackLast());
160 160
         }
161 161
 
162 162
         // Handle opening and closing commands, adding and removing from the stack.
163
-        if($cmd instanceof Mailcode_Commands_Command_Type_Opening)
163
+        if ($cmd instanceof Mailcode_Commands_Command_Type_Opening)
164 164
         {
165 165
             $this->stack[] = $cmd;
166 166
         }
167
-        else if($cmd instanceof Mailcode_Commands_Command_Type_Closing)
167
+        else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing)
168 168
         {
169 169
             array_pop($this->stack);
170 170
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $cmd = $this->stack[array_key_last($this->stack)];
180 180
 
181
-        if($cmd instanceof Mailcode_Commands_Command)
181
+        if ($cmd instanceof Mailcode_Commands_Command)
182 182
         {
183 183
             return $cmd;
184 184
         }
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
         // 5 = parameter type command, type
208 208
         // 6 = parameter type command, params
209 209
         
210
-        if(!empty($matches[1][$index]))
210
+        if (!empty($matches[1][$index]))
211 211
         {
212 212
             $name = $matches[1][$index];
213 213
         }
214
-        else if(!empty($matches[2][$index]))
214
+        else if (!empty($matches[2][$index]))
215 215
         {
216 216
             $name = $matches[2][$index];
217 217
             $params = $matches[3][$index];
218 218
         }
219
-        else if(!empty($matches[4][$index]))
219
+        else if (!empty($matches[4][$index]))
220 220
         {
221 221
             $name = $matches[4][$index];
222 222
             $type = $matches[5][$index];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * @param Mailcode_Commands_Command|null $sourceCommand
254 254
      * @return Mailcode_Parser_Statement
255 255
      */
256
-    public function createStatement(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null) : Mailcode_Parser_Statement
256
+    public function createStatement(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null) : Mailcode_Parser_Statement
257 257
     {
258 258
         return new Mailcode_Parser_Statement($statement, $freeform, $sourceCommand);
259 259
     }
Please login to merge, or discard this patch.
src/Mailcode/Parser/PreParser.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function getContent(int $id) : string
118 118
     {
119
-        if(isset(self::$contents[$id]))
119
+        if (isset(self::$contents[$id]))
120 120
         {
121 121
             return self::$contents[$id];
122 122
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public static function clearContent(int $id) : void
141 141
     {
142
-        if(isset(self::$contents[$id]))
142
+        if (isset(self::$contents[$id]))
143 143
         {
144 144
             unset(self::$contents[$id]);
145 145
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function parse() : self
158 158
     {
159
-        if($this->parsed)
159
+        if ($this->parsed)
160 160
         {
161 161
             return $this;
162 162
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $this->detectCommands();
168 168
 
169
-        foreach($this->commands as $commandDef)
169
+        foreach ($this->commands as $commandDef)
170 170
         {
171 171
             $this->processCommand($commandDef);
172 172
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $commands = Mailcode::create()->getCommands()->getContentCommands();
188 188
         $result = array();
189 189
 
190
-        foreach($commands as $command)
190
+        foreach ($commands as $command)
191 191
         {
192 192
             $result[] = $command->getName();
193 193
         }
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 
261 261
     private function validateCommandContents() : void
262 262
     {
263
-        foreach($this->commands as $command)
263
+        foreach ($this->commands as $command)
264 264
         {
265
-            if(!$command->validateContent($this, $this->collection))
265
+            if (!$command->validateContent($this, $this->collection))
266 266
             {
267 267
                 return;
268 268
             }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
         $openingCommands = $this->detectOpeningCommands();
275 275
         $closingCommands = $this->detectClosingCommands();
276 276
 
277
-        if(!$this->validateCommandsList($openingCommands, $closingCommands))
277
+        if (!$this->validateCommandsList($openingCommands, $closingCommands))
278 278
         {
279 279
             return;
280 280
         }
281 281
 
282
-        foreach($openingCommands as $idx => $def)
282
+        foreach ($openingCommands as $idx => $def)
283 283
         {
284 284
             $this->commands[] = new CommandDef(
285 285
                 $def['name'],
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
         $opening = count($openingCommands);
301 301
         $closing = count($closingCommands);
302 302
         $max = $opening;
303
-        if($closing > $max) {
303
+        if ($closing > $max) {
304 304
             $max = $closing;
305 305
         }
306 306
 
307
-        for($i=0; $i < $max; $i++)
307
+        for ($i = 0; $i < $max; $i++)
308 308
         {
309 309
             // command closed that was never opened
310
-            if(!isset($openingCommands[$i]))
310
+            if (!isset($openingCommands[$i]))
311 311
             {
312 312
                 return $this->addErrorClosedNeverOpened($closingCommands[$i]['matchedText']);
313 313
             }
314 314
 
315 315
             // command opened that was never closed
316
-            if(!isset($closingCommands[$i]))
316
+            if (!isset($closingCommands[$i]))
317 317
             {
318 318
                 return $this->addErrorNeverClosed(
319 319
                     $openingCommands[$i]['matchedText'],
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             }
323 323
 
324 324
             // command closed does not match opening
325
-            if($openingCommands[$i]['name'] !== $closingCommands[$i]['name'])
325
+            if ($openingCommands[$i]['name'] !== $closingCommands[$i]['name'])
326 326
             {
327 327
                 return $this->addErrorClosingMismatch(
328 328
                     $openingCommands[$i]['name'],
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
         $result = array();
379 379
 
380
-        foreach($matches[0] as $idx => $matchedText)
380
+        foreach ($matches[0] as $idx => $matchedText)
381 381
         {
382 382
             $result[] = array(
383 383
                 'name' => strtolower(trim((string)$matches[1][$idx])),
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             $matchedText,
462 462
             t(
463 463
                 'The command is never closed with a matching %1$s command.',
464
-                sb()->code('{' . $name . '}')
464
+                sb()->code('{'.$name.'}')
465 465
             ),
466 466
             Mailcode_Commands_CommonConstants::VALIDATION_MISSING_CONTENT_CLOSING_TAG
467 467
         );
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
                 )
486 486
                 ->t(
487 487
                     'It must be closed with a matching %1$s command.',
488
-                    sb()->code('{' . $name . '}')
488
+                    sb()->code('{'.$name.'}')
489 489
                 ),
490 490
             Mailcode_Commands_CommonConstants::VALIDATION_CONTENT_CLOSING_MISMATCHED_TAG
491 491
         );
Please login to merge, or discard this patch.
src/Mailcode/Parser/PreParser/Debugger.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function debugOpeningCommands(array $matches) : void
32 32
     {
33
-        if(!Mailcode::isDebugEnabled())
33
+        if (!Mailcode::isDebugEnabled())
34 34
         {
35 35
             return;
36 36
         }
37 37
 
38 38
         Mailcode::debug('Opening command matches:');
39 39
 
40
-        if(empty($matches))
40
+        if (empty($matches))
41 41
         {
42 42
             Mailcode::debug('...None found.');
43 43
             return;
44 44
         }
45 45
 
46
-        foreach($matches[0] as $idx => $matchedText)
46
+        foreach ($matches[0] as $idx => $matchedText)
47 47
         {
48
-            $number = $idx+1;
48
+            $number = $idx + 1;
49 49
 
50 50
             Mailcode::debug(sprintf('...#%02d matched: [%s]', $number, $matchedText));
51 51
             Mailcode::debug(sprintf('...#%02d name...: [%s]', $number, $matches[1][$idx]));
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function debugClosingCommands(array $commands) : void
61 61
     {
62
-        if(!Mailcode::isDebugEnabled())
62
+        if (!Mailcode::isDebugEnabled())
63 63
         {
64 64
             return;
65 65
         }
66 66
 
67 67
         Mailcode::debug('Closing command matches:', $commands);
68 68
 
69
-        if(empty($commands))
69
+        if (empty($commands))
70 70
         {
71 71
             Mailcode::debug('...None found.');
72 72
             return;
73 73
         }
74 74
 
75
-        foreach($commands as $idx => $command)
75
+        foreach ($commands as $idx => $command)
76 76
         {
77
-            $number = $idx+1;
77
+            $number = $idx + 1;
78 78
 
79 79
             Mailcode::debug(sprintf('...#%02d matched: [%s]', $number, $command['matchedText']));
80 80
             Mailcode::debug(sprintf('...#%02d name...: [%s]', $number, $command['name']));
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function debugCommandDef(CommandDef $commandDef) : void
85 85
     {
86
-        if(!Mailcode::isDebugEnabled())
86
+        if (!Mailcode::isDebugEnabled())
87 87
         {
88 88
             return;
89 89
         }
90 90
 
91 91
         Mailcode::debug('Command definition:', $commandDef->toArray());
92 92
 
93
-        if(defined('TESTS_ROOT'))
93
+        if (defined('TESTS_ROOT'))
94 94
         {
95 95
             print_r($commandDef->toArray());
96 96
         }
Please login to merge, or discard this patch.
src/Mailcode/Styler.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 {
26 26
     public const ERROR_CSS_FILE_NOT_FOUND = 60901;
27 27
     
28
-   /**
29
-    * @var string
30
-    */
28
+    /**
29
+     * @var string
30
+     */
31 31
     private string $path;
32 32
     
33
-   /**
34
-    * @var string
35
-    */
33
+    /**
34
+     * @var string
35
+     */
36 36
     private string $fileName = 'highlight.css';
37 37
     
38 38
     public function __construct()
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
         $this->path = $path;
56 56
     }
57 57
    
58
-   /**
59
-    * Retrieves the raw CSS source for the highlighting.
60
-    * 
61
-    * @return string
62
-    */
58
+    /**
59
+     * Retrieves the raw CSS source for the highlighting.
60
+     * 
61
+     * @return string
62
+     */
63 63
     public function getCSS() : string
64 64
     {
65 65
         return FileHelper::readContents($this->path);
66 66
     }
67 67
     
68
-   /**
69
-    * Retrieves a fully formed `code` tag with the CSS,
70
-    * to inject inline into an HTML document.
71
-    * 
72
-    * @return string
73
-    */
68
+    /**
69
+     * Retrieves a fully formed `code` tag with the CSS,
70
+     * to inject inline into an HTML document.
71
+     * 
72
+     * @return string
73
+     */
74 74
     public function getStyleTag() : string
75 75
     {
76 76
         return sprintf(
@@ -79,23 +79,23 @@  discard block
 block discarded – undo
79 79
         );
80 80
     }
81 81
     
82
-   /**
83
-    * Retrieves the path to the stylesheet file.
84
-    * 
85
-    * @return string
86
-    */
82
+    /**
83
+     * Retrieves the path to the stylesheet file.
84
+     * 
85
+     * @return string
86
+     */
87 87
     public function getStylesheetPath() : string
88 88
     {
89 89
         return $this->path;
90 90
     }
91 91
     
92
-   /**
93
-    * Retrieves the URL to the stylesheet file, given the
94
-    * local URL to the application's vendor folder.
95
-    *  
96
-    * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).
97
-    * @return string
98
-    */
92
+    /**
93
+     * Retrieves the URL to the stylesheet file, given the
94
+     * local URL to the application's vendor folder.
95
+     *  
96
+     * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).
97
+     * @return string
98
+     */
99 99
     public function getStylesheetURL(string $vendorURL) : string
100 100
     {
101 101
         return sprintf(
Please login to merge, or discard this patch.
src/Mailcode/Renderer.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Mailcode_Renderer
23 23
 {
24
-   /**
25
-    * @var boolean
26
-    */
24
+    /**
25
+     * @var boolean
26
+     */
27 27
     protected bool $highlighted = false;
28 28
     
29
-   /**
30
-    * Sets whether to output highlighted commands instead of the default plain text.
31
-    * 
32
-    * @param bool $highlighted
33
-    * @return Mailcode_Renderer
34
-    */
29
+    /**
30
+     * Sets whether to output highlighted commands instead of the default plain text.
31
+     * 
32
+     * @param bool $highlighted
33
+     * @return Mailcode_Renderer
34
+     */
35 35
     public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer
36 36
     {
37 37
         $this->highlighted = $highlighted;
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
         return $this;
40 40
     }
41 41
     
42
-   /**
43
-    * Converts a show variable command to string.
44
-    * 
45
-    * @param string $variableName The variable name, with or without $ sign.
46
-    * @return string
47
-    */
42
+    /**
43
+     * Converts a show variable command to string.
44
+     * 
45
+     * @param string $variableName The variable name, with or without $ sign.
46
+     * @return string
47
+     */
48 48
     public function showVar(string $variableName) : string
49 49
     {
50 50
         return $this->command2string(Mailcode_Factory::show()->var($variableName));
Please login to merge, or discard this patch.