Test Failed
Pull Request — master (#13)
by Sebastian
05:15
created
src/Mailcode/Traits/Commands/Validation/NoHTML.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
         $keywords = $this->params->getInfo()->getKeywords();
40 40
 
41
-        foreach($keywords as $keyword)
41
+        foreach ($keywords as $keyword)
42 42
         {
43
-            if($keyword->isNoHTML())
43
+            if ($keyword->isNoHTML())
44 44
             {
45 45
                 $this->noHTMLToken = $keyword;
46 46
                 break;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @return $this
56 56
      * @throws Mailcode_Exception
57 57
      */
58
-    public function setHTMLEnabled(bool $enabled=true) : self
58
+    public function setHTMLEnabled(bool $enabled = true) : self
59 59
     {
60 60
         $this->params->getInfo()->setKeywordEnabled(Mailcode_Commands_Keywords::TYPE_NOHTML, !$enabled);
61 61
 
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return Mailcode_Factory_CommandSets_Set_If
59 59
      */
60
-    public static function if() : Mailcode_Factory_CommandSets_Set_If
60
+    public static function if () : Mailcode_Factory_CommandSets_Set_If
61 61
     {
62 62
         return self::getSets()->if();
63 63
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return Mailcode_Factory_CommandSets_Set_ElseIf
69 69
      */
70
-    public static function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
70
+    public static function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
71 71
     {
72 72
         return self::getSets()->elseIf();
73 73
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
     protected static function getSets() : Mailcode_Factory_CommandSets
119 119
     {
120
-        if(!isset(self::$commandSets))
120
+        if (!isset(self::$commandSets))
121 121
         {
122 122
             self::$commandSets = new Mailcode_Factory_CommandSets();
123 123
         }
Please login to merge, or discard this patch.
src/Mailcode/Collection/TypeFilter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $result = array();
34 34
 
35
-        foreach($commands as $command)
35
+        foreach ($commands as $command)
36 36
         {
37
-            if($command instanceof Mailcode_Commands_ShowBase)
37
+            if ($command instanceof Mailcode_Commands_ShowBase)
38 38
             {
39 39
                 $result[] = $command;
40 40
             }
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $result = array();
58 58
 
59
-        foreach($commands as $command)
59
+        foreach ($commands as $command)
60 60
         {
61
-            if($command instanceof Mailcode_Interfaces_Commands_ListVariables)
61
+            if ($command instanceof Mailcode_Interfaces_Commands_ListVariables)
62 62
             {
63 63
                 $result[] = $command;
64 64
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $result = array();
79 79
 
80
-        foreach($commands as $command)
80
+        foreach ($commands as $command)
81 81
         {
82
-            if($command instanceof Mailcode_Commands_Command_ShowVariable)
82
+            if ($command instanceof Mailcode_Commands_Command_ShowVariable)
83 83
             {
84 84
                 $result[] = $command;
85 85
             }
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $result = array();
100 100
 
101
-        foreach($commands as $command)
101
+        foreach ($commands as $command)
102 102
         {
103
-            if($command instanceof Mailcode_Commands_Command_For)
103
+            if ($command instanceof Mailcode_Commands_Command_For)
104 104
             {
105 105
                 $result[] = $command;
106 106
             }
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $result = array();
121 121
 
122
-        foreach($commands as $command)
122
+        foreach ($commands as $command)
123 123
         {
124
-            if($command instanceof Mailcode_Commands_Command_ShowDate)
124
+            if ($command instanceof Mailcode_Commands_Command_ShowDate)
125 125
             {
126 126
                 $result[] = $command;
127 127
             }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $result = array();
142 142
 
143
-        foreach($commands as $command)
143
+        foreach ($commands as $command)
144 144
         {
145
-            if($command instanceof Mailcode_Commands_Command_If)
145
+            if ($command instanceof Mailcode_Commands_Command_If)
146 146
             {
147 147
                 $result[] = $command;
148 148
             }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Normalizer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     
38 38
     public function normalize() : string
39 39
     {
40
-        if(!$this->command->isValid())
40
+        if (!$this->command->isValid())
41 41
         {
42 42
             return '';
43 43
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     
58 58
     private function addType() : void
59 59
     {
60
-        if(!$this->command->supportsType() || !$this->command->hasType())
60
+        if (!$this->command->supportsType() || !$this->command->hasType())
61 61
         {
62 62
             return;
63 63
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $params = $this->getParamsString($command);
71 71
         
72
-        if(empty($params))
72
+        if (empty($params))
73 73
         {
74 74
             return;
75 75
         }
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $params = $this->getParamsStatement($command);
89 89
 
90
-        if($params === null)
90
+        if ($params === null)
91 91
         {
92 92
             return '';
93 93
         }
94 94
 
95
-        if($command->hasFreeformParameters())
95
+        if ($command->hasFreeformParameters())
96 96
         {
97 97
             return $params->getStatementString();
98 98
         }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 
103 103
     private function addLogicKeywords() : void
104 104
     {
105
-        if(!$this->command->supportsLogicKeywords())
105
+        if (!$this->command->supportsLogicKeywords())
106 106
         {
107 107
             return;
108 108
         }
109 109
         
110 110
         $keywords = $this->command->getLogicKeywords()->getKeywords();
111 111
         
112
-        foreach($keywords as $keyword)
112
+        foreach ($keywords as $keyword)
113 113
         {
114 114
             $this->parts[] = ' ';
115 115
             $this->parts[] = $keyword->getKeywordString(); // e.g. "if variable"
Please login to merge, or discard this patch.
src/Mailcode/Commands/Normalizer/ProtectedContent.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function __construct(Mailcode_Commands_Command $command)
41 41
     {
42
-        if(!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
42
+        if (!$command instanceof Mailcode_Interfaces_Commands_ProtectedContent)
43 43
         {
44 44
             throw new Mailcode_Exception(
45 45
                 'Invalid command',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $params = $command->getParams();
68 68
 
69
-        if($params === null)
69
+        if ($params === null)
70 70
         {
71 71
             return null;
72 72
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         $contentID = $info->getTokenByIndex(0);
92 92
 
93
-        if($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
93
+        if ($contentID instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number)
94 94
         {
95 95
             $info->removeToken($contentID);
96 96
             return $copy;
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/Code.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function getSyntaxName() : string
113 113
     {
114
-        if(isset($this->langToken))
114
+        if (isset($this->langToken))
115 115
         {
116 116
             return $this->langToken->getText();
117 117
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             ->getInfo()
135 135
             ->getStringLiteralByIndex(1);
136 136
 
137
-        if($lang)
137
+        if ($lang)
138 138
         {
139 139
             $this->langToken = $lang;
140 140
             return;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     {
159 159
         // To keep PHPStan happy. If no token has been found, this
160 160
         // method will not be called.
161
-        if(!isset($this->langToken))
161
+        if (!isset($this->langToken))
162 162
         {
163 163
             return;
164 164
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $name = $this->langToken->getText();
167 167
         $supported = self::getSupportedSyntaxes();
168 168
 
169
-        if(in_array($name, $supported))
169
+        if (in_array($name, $supported))
170 170
         {
171 171
             return;
172 172
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/Mono.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $literals = $this->requireParams()->getInfo()->getStringLiterals();
86 86
 
87
-        if(empty($literals)) {
87
+        if (empty($literals)) {
88 88
             return;
89 89
         }
90 90
 
91
-        foreach($literals as $literal)
91
+        foreach ($literals as $literal)
92 92
         {
93 93
             $parts = ConvertHelper::explodeTrim(' ', $literal->getText());
94 94
 
95
-            foreach($parts as $part) {
95
+            foreach ($parts as $part) {
96 96
                 $this->addClass($part);
97 97
             }
98 98
         }
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $className = trim($className);
108 108
 
109
-        if($this->isClassNameValid($className))
109
+        if ($this->isClassNameValid($className))
110 110
         {
111
-            if(!in_array($className, $this->classes, true)) {
111
+            if (!in_array($className, $this->classes, true)) {
112 112
                 $this->classes[] = $className;
113 113
             }
114 114
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     public function preProcessOpening(): string
142 142
     {
143
-        if($this->isMultiline()) {
143
+        if ($this->isMultiline()) {
144 144
             return sprintf('<pre%s>', $this->renderAttributes());
145 145
         }
146 146
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function preProcessClosing(): string
151 151
     {
152
-        if($this->isMultiline()) {
152
+        if ($this->isMultiline()) {
153 153
             return '</pre>';
154 154
         }
155 155
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     private function renderAttributes() : string
160 160
     {
161
-        if(empty($this->classes)) {
161
+        if (empty($this->classes)) {
162 162
             return '';
163 163
         }
164 164
 
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.