Test Failed
Push — master ( 36c5b6...af11e6 )
by Sebastian
04:51
created
src/Mailcode/Commands/Command/For.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@
 block discarded – undo
33 33
     public const VALIDATION_VARIABLE_NAME_WITH_DOT = 49704;
34 34
     public const VALIDATION_LOOP_VARIABLE_NAME_WITH_DOT = 49705;
35 35
     
36
-   /**
37
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
38
-    */
36
+    /**
37
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
38
+     */
39 39
     private ?Mailcode_Parser_Statement_Tokenizer_Token_Variable $loopVar = null;
40 40
     
41
-   /**
42
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
43
-    */
41
+    /**
42
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
43
+     */
44 44
     private ?Mailcode_Parser_Statement_Tokenizer_Token_Variable $sourceVar = null;
45 45
     
46
-   /**
47
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL
48
-    */
46
+    /**
47
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL
48
+     */
49 49
     private ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword $keyword = null;
50 50
     
51 51
     public function getName() : string
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     
102 102
     public function getSourceVariable() : Mailcode_Variables_Variable
103 103
     {
104
-        if(isset($this->sourceVar))
104
+        if (isset($this->sourceVar))
105 105
         {
106 106
             return $this->sourceVar->getVariable();
107 107
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function getLoopVariable() : Mailcode_Variables_Variable
117 117
     {
118
-        if(isset($this->loopVar))
118
+        if (isset($this->loopVar))
119 119
         {
120 120
             return $this->loopVar->getVariable();
121 121
         }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $this->keyword = $info->getKeywordByIndex(1);
136 136
         $this->sourceVar = $info->getVariableByIndex(2);
137 137
         
138
-        if(!$this->loopVar || !$this->keyword || !$this->sourceVar)
138
+        if (!$this->loopVar || !$this->keyword || !$this->sourceVar)
139 139
         {
140 140
             $this->validationResult->makeError(
141 141
                 t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'),
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $keyword = $this->getInKeyword();
152 152
 
153
-        if($keyword->isForIn())
153
+        if ($keyword->isForIn())
154 154
         {
155 155
             return;
156 156
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     
164 164
     protected function validateSyntax_variable_names() : void
165 165
     {
166
-        if($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName())
166
+        if ($this->getSourceVariable()->getFullName() !== $this->getLoopVariable()->getFullName())
167 167
         {
168 168
             return;
169 169
         }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
         $parts = explode('.', $name);
182 182
 
183
-        if(count($parts) === 1) {
183
+        if (count($parts) === 1) {
184 184
             return;
185 185
         }
186 186
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
         $parts = explode('.', $name);
199 199
 
200
-        if(count($parts) === 1) {
200
+        if (count($parts) === 1) {
201 201
             return;
202 202
         }
203 203
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
     public function getInKeyword() : Mailcode_Parser_Statement_Tokenizer_Token_Keyword
216 216
     {
217
-        if(isset($this->keyword))
217
+        if (isset($this->keyword))
218 218
         {
219 219
             return $this->keyword;
220 220
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowPhone.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $val = $this->validator->createStringLiteral();
74 74
 
75
-        if($val->isValid())
75
+        if ($val->isValid())
76 76
         {
77 77
             $this->sourceFormat = strtoupper($val->getToken()->getText());
78 78
             return;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $countries = self::getSupportedCountries();
96 96
 
97
-        if(isset($countries[$this->sourceFormat])) {
97
+        if (isset($countries[$this->sourceFormat])) {
98 98
             return;
99 99
         }
100 100
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public static function getSupportedCountries() : array
115 115
     {
116
-        if(self::$countriesLoaded) {
116
+        if (self::$countriesLoaded) {
117 117
             return self::$supportedCountries;
118 118
         }
119 119
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
         $data = self::loadData();
123 123
 
124
-        foreach($data as $code => $def)
124
+        foreach ($data as $code => $def)
125 125
         {
126 126
             $code = (string)$code;
127 127
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
         $data = FileHelper::parseJSONFile(__DIR__.'/ShowPhone/numbers.json');
146 146
         $result = array();
147 147
 
148
-        foreach($data as $idx => $def)
148
+        foreach ($data as $idx => $def)
149 149
         {
150
-            if(!is_array($def) || !is_string($idx))
150
+            if (!is_array($def) || !is_string($idx))
151 151
             {
152 152
                 continue;
153 153
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/LogicKeywords.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     
72 72
     private function parse() : void
73 73
     {
74
-        foreach($this->names as $name)
74
+        foreach ($this->names as $name)
75 75
         {
76
-            if(!stristr($this->paramsString, $name))
76
+            if (!stristr($this->paramsString, $name))
77 77
             {
78 78
                 continue;
79 79
             }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $names = $this->getDetectedNames();
91 91
         $amount = count($names);
92 92
         
93
-        if($amount > 1)
93
+        if ($amount > 1)
94 94
         {
95 95
             $this->makeError(
96 96
                 t(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     
111 111
     private function splitParams() : void
112 112
     {
113
-        if(empty($this->keywords))
113
+        if (empty($this->keywords))
114 114
         {
115 115
             $this->mainParams = $this->paramsString;
116 116
             
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
         
120 120
         $params = $this->detectParameters();
121 121
         
122
-        foreach($this->keywords as $keyword)
122
+        foreach ($this->keywords as $keyword)
123 123
         {
124 124
             $kParams = (string)array_shift($params);
125 125
             
126 126
             $keyword->setParamsString($kParams);
127 127
             
128
-            if(!$keyword->isValid())
128
+            if (!$keyword->isValid())
129 129
             {
130 130
                 $this->makeError(
131 131
                     t('Error #%1$s:', $keyword->getCode()).' '.$keyword->getErrorMessage(),
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $params = $this->paramsString;
146 146
         $stack = array();
147 147
         
148
-        foreach($this->keywords as $keyword)
148
+        foreach ($this->keywords as $keyword)
149 149
         {
150 150
             $params = $this->detectParamsKeyword($params, $keyword, $stack);
151 151
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $search = $keyword->getMatchedString();
170 170
         $pos = strpos($params, $search, 0);
171 171
         
172
-        if($pos === false)
172
+        if ($pos === false)
173 173
         {
174 174
             throw new Mailcode_Exception(
175 175
                 'Keyword matched string not found',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $length = strlen($search);
182 182
         
183 183
         $store = substr($params, 0, $pos);
184
-        $params = trim(substr($params, $pos+$length));
184
+        $params = trim(substr($params, $pos + $length));
185 185
         
186 186
         $stack[] = $store;
187 187
         
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $names = array();
210 210
         
211
-        foreach($this->keywords as $keyword)
211
+        foreach ($this->keywords as $keyword)
212 212
         {
213 213
             $name = $keyword->getName();
214 214
             
215
-            if(!in_array($name, $names))
215
+            if (!in_array($name, $names))
216 216
             {
217 217
                 $names[] = $name;
218 218
             }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         $matches = array();
246 246
         preg_match_all($regex, $this->paramsString, $matches, PREG_PATTERN_ORDER);
247 247
         
248
-        if(!isset($matches[0][0]) || empty($matches[0][0]))
248
+        if (!isset($matches[0][0]) || empty($matches[0][0]))
249 249
         {
250 250
             return array();
251 251
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $amount = count($matches[0]);
254 254
         $result = array();
255 255
         
256
-        for($i=0; $i < $amount; $i++)
256
+        for ($i = 0; $i < $amount; $i++)
257 257
         {
258 258
             $result[] = $this->createKeyword(
259 259
                 $name, 
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
         return !empty($this->keywords);
271 271
     }
272 272
     
273
-    public function appendAND(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword
273
+    public function appendAND(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword
274 274
     {
275 275
         return $this->appendKeyword('and', $paramsString, $type);
276 276
     }
277 277
     
278
-    public function appendOR(string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword
278
+    public function appendOR(string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword
279 279
     {
280 280
         return $this->appendKeyword('or', $paramsString, $type);
281 281
     }
282 282
     
283
-    public function appendKeyword(string $name, string $paramsString, string $type='') : Mailcode_Commands_LogicKeywords_Keyword
283
+    public function appendKeyword(string $name, string $paramsString, string $type = '') : Mailcode_Commands_LogicKeywords_Keyword
284 284
     {
285 285
         $keyword = $this->createKeyword($name, $type);
286 286
         $keyword->setParamsString($paramsString);
287 287
         
288
-        if(!$keyword->isValid())
288
+        if (!$keyword->isValid())
289 289
         {
290 290
             throw new Mailcode_Exception(
291 291
                 'Cannot append invalid logic keyword',
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
         return $keyword;
307 307
     }
308 308
     
309
-    private function createKeyword(string $name, string $type='', string $matchedString='') : Mailcode_Commands_LogicKeywords_Keyword
309
+    private function createKeyword(string $name, string $type = '', string $matchedString = '') : Mailcode_Commands_LogicKeywords_Keyword
310 310
     {
311
-        if(empty($matchedString))
311
+        if (empty($matchedString))
312 312
         {
313 313
             $matchedString = $name;
314 314
             
315
-            if(!empty($type))
315
+            if (!empty($type))
316 316
             {
317 317
                 $matchedString .= ' '.$type;
318 318
             }
Please login to merge, or discard this patch.
src/Mailcode/Collection.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
     public const ERROR_CANNOT_MODIFY_FINALIZED = 52302;
27 27
     public const ERROR_NO_VALIDATION_RESULT_AVAILABLE = 52303;
28 28
     
29
-   /**
30
-    * @var Mailcode_Commands_Command[]
31
-    */
29
+    /**
30
+     * @var Mailcode_Commands_Command[]
31
+     */
32 32
     protected array $commands = array();
33 33
     
34 34
     /**
@@ -63,21 +63,21 @@  discard block
 block discarded – undo
63 63
         return $this;
64 64
     }
65 65
     
66
-   /**
67
-    * Whether there are any commands in the collection.
68
-    * 
69
-    * @return bool
70
-    */
66
+    /**
67
+     * Whether there are any commands in the collection.
68
+     * 
69
+     * @return bool
70
+     */
71 71
     public function hasCommands() : bool
72 72
     {
73 73
         return !empty($this->commands);
74 74
     }
75 75
     
76
-   /**
77
-    * Counts the amount of commands in the collection.
78
-    * 
79
-    * @return int
80
-    */
76
+    /**
77
+     * Counts the amount of commands in the collection.
78
+     * 
79
+     * @return int
80
+     */
81 81
     public function countCommands() : int
82 82
     {
83 83
         return count($this->commands);
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
         $this->commands = $keep;
99 99
     }
100 100
     
101
-   /**
102
-    * Retrieves all commands that were detected, in the exact order
103
-    * they were found.
104
-    * 
105
-    * @return Mailcode_Commands_Command[]
106
-    */
101
+    /**
102
+     * Retrieves all commands that were detected, in the exact order
103
+     * they were found.
104
+     * 
105
+     * @return Mailcode_Commands_Command[]
106
+     */
107 107
     public function getCommands() : array
108 108
     {
109 109
         $this->validate();
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
     }
358 358
 
359 359
     /**
360
-    * Retrieves only show variable commands in the collection, if any.
361
-    * 
362
-    * @return Mailcode_Commands_Command_ShowVariable[]
363
-    */
360
+     * Retrieves only show variable commands in the collection, if any.
361
+     * 
362
+     * @return Mailcode_Commands_Command_ShowVariable[]
363
+     */
364 364
     public function getShowVariableCommands(): array
365 365
     {
366 366
         return Mailcode_Collection_TypeFilter::getShowVariableCommands($this->commands);
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
         return Mailcode_Collection_TypeFilter::getForCommands($this->commands);
375 375
     }
376 376
 
377
-   /**
378
-    * Retrieves only show date commands in the collection, if any.
379
-    *
380
-    * @return Mailcode_Commands_Command_ShowDate[]
381
-    */
377
+    /**
378
+     * Retrieves only show date commands in the collection, if any.
379
+     *
380
+     * @return Mailcode_Commands_Command_ShowDate[]
381
+     */
382 382
     public function getShowDateCommands() : array
383 383
     {
384 384
         return Mailcode_Collection_TypeFilter::getShowDateCommands($this->commands);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function addCommand(Mailcode_Commands_Command $command) : Mailcode_Collection
47 47
     {
48
-        if($this->finalized)
48
+        if ($this->finalized)
49 49
         {
50 50
             throw new Mailcode_Exception(
51 51
                 'Cannot add commands to a finalized collection',
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $keep = array();
89 89
 
90
-        foreach($this->commands as $existing)
90
+        foreach ($this->commands as $existing)
91 91
         {
92
-            if($existing !== $command)
92
+            if ($existing !== $command)
93 93
             {
94 94
                 $keep[] = $existing;
95 95
             }
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
         $hashes = array();
128 128
         
129
-        foreach($this->commands as $command)
129
+        foreach ($this->commands as $command)
130 130
         {
131 131
             $hash = $command->getHash();
132 132
             
133
-            if(!isset($hashes[$hash]))
133
+            if (!isset($hashes[$hash]))
134 134
             {
135 135
                 $hashes[$hash] = $command;
136 136
             }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function addCommands(array $commands) : Mailcode_Collection
150 150
     {
151
-        foreach($commands as $command)
151
+        foreach ($commands as $command)
152 152
         {
153 153
             $this->addCommand($command);
154 154
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         $collection = new Mailcode_Variables_Collection_Regular();
173 173
         
174
-        foreach($this->commands as $command)
174
+        foreach ($this->commands as $command)
175 175
         {
176 176
             $collection->mergeWith($command->getVariables());
177 177
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $this->validate();
213 213
 
214
-        if(isset($this->validationResult))
214
+        if (isset($this->validationResult))
215 215
         {
216 216
             return $this->validationResult;
217 217
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
     private function validate() : void
227 227
     {
228
-        if(isset($this->validationResult) || $this->validating)
228
+        if (isset($this->validationResult) || $this->validating)
229 229
         {
230 230
             return;
231 231
         }
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $errors = $this->getErrors();
247 247
         
248
-        foreach($errors as $error)
248
+        foreach ($errors as $error)
249 249
         {
250
-            if($error->getCode() === $code)
250
+            if ($error->getCode() === $code)
251 251
             {
252 252
                 return true;
253 253
             }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         $errors = $this->errors;
284 284
 
285
-        if(!$result->isValid())
285
+        if (!$result->isValid())
286 286
         {
287 287
             $errors[] = new Mailcode_Collection_Error_Message(
288 288
                 '',
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     {
299 299
         $errors = $this->getErrors();
300 300
 
301
-        if(!empty($errors))
301
+        if (!empty($errors))
302 302
         {
303 303
             return array_shift($errors);
304 304
         }
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 
320 320
     private function validateNesting() : void
321 321
     {
322
-        foreach($this->commands as $command)
322
+        foreach ($this->commands as $command)
323 323
         {
324 324
             $command->validateNesting();
325 325
 
326
-            if(!$command->isValid()) {
326
+            if (!$command->isValid()) {
327 327
                 $this->addInvalidCommand($command);
328 328
             }
329 329
         }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     {
401 401
         $commands = $this->getCommands();
402 402
         
403
-        if(!empty($commands))
403
+        if (!empty($commands))
404 404
         {
405 405
             return array_shift($commands);
406 406
         }
@@ -432,16 +432,16 @@  discard block
 block discarded – undo
432 432
      */
433 433
     private function pruneProtectedContentCommands() : void
434 434
     {
435
-        if(!$this->isValid())
435
+        if (!$this->isValid())
436 436
         {
437 437
             return;
438 438
         }
439 439
 
440 440
         $keep = array();
441 441
 
442
-        foreach($this->commands as $command)
442
+        foreach ($this->commands as $command)
443 443
         {
444
-            if(!$command->hasContentParent())
444
+            if (!$command->hasContentParent())
445 445
             {
446 446
                 $keep[] = $command;
447 447
             }
Please login to merge, or discard this patch.
src/Mailcode/Interfaces/Commands/Validation/NoHTML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public const VALIDATION_NAME_NOHTML = 'nohtml';
10 10
 
11
-    public function setHTMLEnabled(bool $enabled=true) : self;
11
+    public function setHTMLEnabled(bool $enabled = true) : self;
12 12
 
13 13
     public function isHTMLEnabled() : bool;
14 14
 
Please login to merge, or discard this patch.