Passed
Push — master ( a60ac2...b0c01a )
by
unknown
09:12
created
src/Mailcode/Traits/Commands/ProtectedContent.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             ->getInfo()
48 48
             ->getTokenByIndex(0);
49 49
 
50
-        if($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
50
+        if ($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
51 51
         {
52 52
             $this->contentIDToken = $contentIDToken;
53 53
             $this->loadContent();
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function getNestedMailcode() : Mailcode_Collection
64 64
     {
65
-         if(isset($this->nestedMailcode))
65
+         if (isset($this->nestedMailcode))
66 66
          {
67 67
              return $this->nestedMailcode;
68 68
          }
69 69
 
70
-         if($this->isMailcodeEnabled())
70
+         if ($this->isMailcodeEnabled())
71 71
          {
72 72
              $collection = Mailcode::create()->parseString($this->getContent());
73 73
          }
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $collection = $this->getNestedMailcode();
87 87
 
88
-        if($collection->isValid())
88
+        if ($collection->isValid())
89 89
         {
90 90
             return;
91 91
         }
92 92
 
93 93
         $errors = $collection->getErrors();
94 94
 
95
-        foreach($errors as $error)
95
+        foreach ($errors as $error)
96 96
         {
97 97
             $this->getValidationResult()->makeError(
98 98
                 $error->getMessage(),
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
     public function getContentID() : int
105 105
     {
106
-        if(isset($this->contentIDToken))
106
+        if (isset($this->contentIDToken))
107 107
         {
108 108
             return (int)$this->contentIDToken->getValue();
109 109
         }
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $variables = parent::getVariables();
135 135
 
136
-        if($this->isMailcodeEnabled())
136
+        if ($this->isMailcodeEnabled())
137 137
         {
138 138
             $nested = $this->getNestedMailcode()
139 139
                 ->getVariables()
140 140
                 ->getAll();
141 141
 
142
-            foreach($nested as $variable)
142
+            foreach ($nested as $variable)
143 143
             {
144 144
                 $variables->add($variable);
145 145
             }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfContains.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@
 block discarded – undo
45 45
             ->getInfo()
46 46
             ->getStringLiterals();
47 47
 
48
-        foreach($tokens as $token)
48
+        foreach ($tokens as $token)
49 49
         {
50 50
             $this->searchTerms[] = $token;
51 51
         }
52 52
         
53
-        if(empty($this->searchTerms))
53
+        if (empty($this->searchTerms))
54 54
         {
55 55
             $this->validationResult->makeError(
56 56
                 t('No search terms found:').' '.
Please login to merge, or discard this patch.
src/Mailcode/Commands.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         static $ids = array();
49 49
         
50
-        if(empty($ids)) {
50
+        if (empty($ids)) {
51 51
             $ids = FileHelper::createFileFinder(__DIR__.'/Commands/Command')
52 52
             ->getPHPClassNames();
53 53
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getAll() : array
67 67
     {
68
-        if(!empty($this->commands)) {
68
+        if (!empty($this->commands)) {
69 69
             return $this->commands;
70 70
         }
71 71
         
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         
74 74
         $result = array();
75 75
         
76
-        foreach($ids as $id) 
76
+        foreach ($ids as $id) 
77 77
         {
78 78
             $result[] = $this->getDummyCommand($id);
79 79
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         static $instances = array();
100 100
         
101
-        if(!isset($instances[$id])) 
101
+        if (!isset($instances[$id])) 
102 102
         {
103 103
             $instances[$id] = $this->createCommand($id, '__dummy', '', '');
104 104
         }
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $items = $this->getAll();
121 121
         
122
-        foreach($items as $item) 
122
+        foreach ($items as $item) 
123 123
         {
124
-            if($item->getName() === $name) {
124
+            if ($item->getName() === $name) {
125 125
                 return $item->getID();
126 126
             }
127 127
         }
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $items = $this->getAll();
156 156
         
157
-        foreach($items as $item)
157
+        foreach ($items as $item)
158 158
         {
159
-            if($item->getName() === $name) {
159
+            if ($item->getName() === $name) {
160 160
                 return true;
161 161
             }
162 162
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     {
177 177
         $class = $this->resolveClassName($id, $type);
178 178
         
179
-        if(!class_exists($class))
179
+        if (!class_exists($class))
180 180
         {
181 181
             throw new Mailcode_Factory_Exception(
182 182
                 'No such command',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         
192 192
         $command = new $class($type, $params, $matchedString);
193 193
 
194
-        if($command instanceof Mailcode_Commands_Command)
194
+        if ($command instanceof Mailcode_Commands_Command)
195 195
         {
196 196
             return $command;
197 197
         }
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         
213 213
         $dummy = $this->getDummyCommand($id);
214 214
         
215
-        if($dummy->supportsType())
215
+        if ($dummy->supportsType())
216 216
         {
217
-            if(empty($type))
217
+            if (empty($type))
218 218
             {
219 219
                 $type = $dummy->getDefaultType();
220 220
             }
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
      */
253 253
     private function getDummyCommand(string $id) : Mailcode_Commands_Command
254 254
     {
255
-        if(isset(self::$dummyCommands[$id])) {
255
+        if (isset(self::$dummyCommands[$id])) {
256 256
             return self::$dummyCommands[$id];
257 257
         }
258 258
 
259 259
         $class = 'Mailcode\Mailcode_Commands_Command_'.$id;
260 260
         $cmd = new $class('__dummy');
261 261
 
262
-        if($cmd instanceof Mailcode_Commands_Command)
262
+        if ($cmd instanceof Mailcode_Commands_Command)
263 263
         {
264 264
             self::$dummyCommands[$id] = $cmd;
265 265
             return $cmd;
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
         $result = array();
285 285
         $commands = $this->getAll();
286 286
 
287
-        foreach($commands as $command)
287
+        foreach ($commands as $command)
288 288
         {
289
-            if($command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
289
+            if ($command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
290 290
             {
291 291
                 $result[] = $command;
292 292
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     private int $instanceID;
134 134
 
135
-    public function __construct(string $type='', string $paramsString='', string $matchedText='')
135
+    public function __construct(string $type = '', string $paramsString = '', string $matchedText = '')
136 136
     {
137 137
         self::$instanceCounter++;
138 138
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $this->requireNonDummy();
225 225
         
226
-        if($this->hash === '') {
226
+        if ($this->hash === '') {
227 227
             $this->hash = md5($this->matchedText);
228 228
         }
229 229
         
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function requireNonDummy() : void
238 238
     {
239
-        if(!$this->isDummy())
239
+        if (!$this->isDummy())
240 240
         {
241 241
             return;
242 242
         }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     
256 256
     protected function validate() : OperationResult
257 257
     {
258
-        if(!$this->validated)
258
+        if (!$this->validated)
259 259
         {
260 260
             $this->requireNonDummy();
261 261
             $this->validateSyntax();
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $validations = $this->resolveValidations();
277 277
 
278
-        foreach($validations as $validation)
278
+        foreach ($validations as $validation)
279 279
         {
280 280
             // break off at the first validation issue
281
-            if(!$this->validateSyntaxMethod($validation))
281
+            if (!$this->validateSyntaxMethod($validation))
282 282
             {
283 283
                 return;
284 284
             }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $method = 'validateSyntax_'.$validation;
304 304
         
305
-        if(!method_exists($this, $method))
305
+        if (!method_exists($this, $method))
306 306
         {
307 307
             throw new CommandException(
308 308
                 'Missing validation method ['.$validation.']',
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
     public function validateNesting() : OperationResult
334 334
     {
335
-        if($this->nestingValidated)
335
+        if ($this->nestingValidated)
336 336
         {
337 337
             return $this->validationResult;
338 338
         }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     
357 357
     public function getType() : string
358 358
     {
359
-        if($this->supportsType())
359
+        if ($this->supportsType())
360 360
         {
361 361
             return $this->type;
362 362
         }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     
377 377
     public function getHighlighted() : string
378 378
     {
379
-        if(!$this->isValid())
379
+        if (!$this->isValid())
380 380
         {
381 381
             return '';
382 382
         }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     
387 387
     public function getParamsString() : string
388 388
     {
389
-        if($this->requiresParameters())
389
+        if ($this->requiresParameters())
390 390
         {
391 391
             return $this->paramsString;
392 392
         }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      */
406 406
     public function requireParams() : Mailcode_Parser_Statement
407 407
     {
408
-        if(isset($this->params))
408
+        if (isset($this->params))
409 409
         {
410 410
             return $this->params;
411 411
         }
@@ -437,22 +437,22 @@  discard block
 block discarded – undo
437 437
      */
438 438
     final public function getCommandType() : string
439 439
     {
440
-        if($this instanceof Mailcode_Commands_Command_Type_Closing)
440
+        if ($this instanceof Mailcode_Commands_Command_Type_Closing)
441 441
         {
442 442
             return 'Closing';
443 443
         }
444 444
         
445
-        if($this instanceof Mailcode_Commands_Command_Type_Opening)
445
+        if ($this instanceof Mailcode_Commands_Command_Type_Opening)
446 446
         {
447 447
             return 'Opening';
448 448
         }
449 449
         
450
-        if($this instanceof Mailcode_Commands_Command_Type_Sibling)
450
+        if ($this instanceof Mailcode_Commands_Command_Type_Sibling)
451 451
         {
452 452
             return 'Sibling';
453 453
         }
454 454
         
455
-        if($this instanceof Mailcode_Commands_Command_Type_Standalone)
455
+        if ($this instanceof Mailcode_Commands_Command_Type_Standalone)
456 456
         {
457 457
             return 'Standalone';
458 458
         }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      */
494 494
     public function getLogicKeywords() : Mailcode_Commands_LogicKeywords
495 495
     {
496
-        if(isset($this->logicKeywords) && $this->supportsLogicKeywords())
496
+        if (isset($this->logicKeywords) && $this->supportsLogicKeywords())
497 497
         {
498 498
             return $this->logicKeywords;
499 499
         }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
     protected function getValidator() : Mailcode_Parser_Statement_Validator
525 525
     {
526
-        if(isset($this->validator))
526
+        if (isset($this->validator))
527 527
         {
528 528
             return $this->validator;
529 529
         }
Please login to merge, or discard this patch.
src/Mailcode/Interfaces/Commands/Validation/URLDecode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      * @return $this
33 33
      * @throws ParamsException
34 34
      */
35
-    public function setURLDecoding(bool $enabled=true) : self;
35
+    public function setURLDecoding(bool $enabled = true) : self;
36 36
 
37 37
     public function isURLDecoded(): bool;
38 38
 }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/URLDecode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * @return $this
36 36
      * @throws Mailcode_Exception
37 37
      */
38
-    public function setURLDecoding(bool $enabled=true) : self
38
+    public function setURLDecoding(bool $enabled = true) : self
39 39
     {
40 40
         return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_URLDECODE, $enabled);
41 41
     }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/URLEncode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      * @return $this
42 42
      * @throws Mailcode_Exception
43 43
      */
44
-    public function setURLEncoding(bool $enabled=true) : self
44
+    public function setURLEncoding(bool $enabled = true) : self
45 45
     {
46 46
         return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_URLENCODE, $enabled);
47 47
     }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowEncoded.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function getTextToken() : Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral
68 68
     {
69
-        if(isset($this->textToken))
69
+        if (isset($this->textToken))
70 70
         {
71 71
             return $this->textToken;
72 72
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
     public function setText(string $text) : self
87 87
     {
88
-        if(isset($this->textToken))
88
+        if (isset($this->textToken))
89 89
         {
90 90
             $this->textToken->setText($text);
91 91
             return $this;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             ->getInfo()
105 105
             ->getStringLiterals();
106 106
 
107
-        if(empty($strings))
107
+        if (empty($strings))
108 108
         {
109 109
             $this->getValidationResult()->makeError(
110 110
                 t('No text to encode has been specified.'),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             ->getInfo()
123 123
             ->getKeywords();
124 124
 
125
-        if(!empty($keywords))
125
+        if (!empty($keywords))
126 126
         {
127 127
             return;
128 128
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Show/Encoded.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         $this->instantiator->checkCommand($cmd);
45 45
 
46
-        if($cmd instanceof Mailcode_Commands_Command_ShowEncoded)
46
+        if ($cmd instanceof Mailcode_Commands_Command_ShowEncoded)
47 47
         {
48 48
             return $cmd;
49 49
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $params = array();
62 62
         $params[] = $this->instantiator->quoteString($subject);
63 63
 
64
-        foreach($encodings as $keyword)
64
+        foreach ($encodings as $keyword)
65 65
         {
66 66
             $params[] = $this->instantiator->filterKeyword($keyword);
67 67
         }
Please login to merge, or discard this patch.