Test Failed
Push — master ( 9ff364...742ef2 )
by Sebastian
03:58
created
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowSnippet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     {
30 30
         $varName = ltrim($command->getVariableName(), '$');
31 31
 
32
-        if($command->isHTMLEnabled())
32
+        if ($command->isHTMLEnabled())
33 33
         {
34 34
             $statement = sprintf(
35 35
                 '%s.replaceAll($esc.newline, "<br/>")',
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowNumber.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
          $tokens = $this->params->getInfo()->getStringLiterals();
69 69
          
70 70
          // no format specified? Use the default one.
71
-         if(empty($tokens))
71
+         if (empty($tokens))
72 72
          {
73 73
              return;
74 74
          }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $keywords = $this->params->getInfo()->getKeywords();
83 83
 
84
-        foreach($keywords as $keyword)
84
+        foreach ($keywords as $keyword)
85 85
         {
86
-            if($keyword->getKeyword() === Mailcode_Commands_Keywords::TYPE_ABSOLUTE)
86
+            if ($keyword->getKeyword() === Mailcode_Commands_Keywords::TYPE_ABSOLUTE)
87 87
             {
88 88
                 $this->absoluteKeyword = $keyword;
89 89
                 break;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $result = new Mailcode_Number_Info($format);
97 97
 
98
-        if($result->isValid())
98
+        if ($result->isValid())
99 99
         {
100 100
             $this->formatString = $format;
101 101
             return;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 
125 125
     public function setAbsolute(bool $absolute) : Mailcode_Commands_Command_ShowNumber
126 126
     {
127
-        if($absolute === false && isset($this->absoluteKeyword))
127
+        if ($absolute === false && isset($this->absoluteKeyword))
128 128
         {
129 129
             $this->params->getInfo()->removeKeyword($this->absoluteKeyword->getKeyword());
130 130
             $this->absoluteKeyword = null;
131 131
         }
132 132
 
133
-        if($absolute === true && !isset($this->absoluteKeyword))
133
+        if ($absolute === true && !isset($this->absoluteKeyword))
134 134
         {
135 135
              $this->params
136 136
                  ->getInfo()
Please login to merge, or discard this patch.
src/Mailcode/Variables/Collection/Invalid.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection
28 28
     {
29
-        if($variable->isValid())
29
+        if ($variable->isValid())
30 30
         {
31 31
             return $this;
32 32
         }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $first = $this->getFirst();
40 40
 
41
-        if($first)
41
+        if ($first)
42 42
         {
43 43
             return $first->getValidationResult();
44 44
         }
Please login to merge, or discard this patch.
src/Mailcode/Variables/Variable.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
     private ?Mailcode_Commands_Command $command;
74 74
 
75
-    public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand=null)
75
+    public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand = null)
76 76
     {
77 77
         $this->path = $path;
78 78
         $this->name = $name;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     
96 96
     public function getFullName() : string
97 97
     {
98
-        if(empty($this->path))
98
+        if (empty($this->path))
99 99
         {
100 100
             return '$'.$this->name;
101 101
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getUniqueName() : string
115 115
     {
116
-        if(isset($this->command))
116
+        if (isset($this->command))
117 117
         {
118 118
             return $this->getFullName().'/'.$this->command->getHash();
119 119
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     
139 139
     public function getHash() : string
140 140
     {
141
-        if(empty($this->hash))
141
+        if (empty($this->hash))
142 142
         {
143 143
             $this->hash = md5($this->matchedText);
144 144
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function getValidationResult() : OperationResult
159 159
     {
160
-        if(isset($this->validationResult))
160
+        if (isset($this->validationResult))
161 161
         {
162 162
             return $this->validationResult;
163 163
         }
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
     protected function validate(OperationResult $result) : void
173 173
     {
174
-        foreach($this->validations as $validation)
174
+        foreach ($this->validations as $validation)
175 175
         {
176 176
             $method = 'validate_'.$validation;
177 177
             
178
-            if(!method_exists($this, $method))
178
+            if (!method_exists($this, $method))
179 179
             {
180 180
                 throw new Mailcode_Exception(
181 181
                     'Unknown validation method',
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     
221 221
     protected function validateNumber(string $value, int $errorCode) : void
222 222
     {
223
-        if(!is_numeric(substr($value, 0, 1)))
223
+        if (!is_numeric(substr($value, 0, 1)))
224 224
         {
225 225
             return;
226 226
         }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     protected function validateUnderscore(string $value, int $errorCode) : void
239 239
     {
240 240
         // allow empty paths
241
-        if(empty($value))
241
+        if (empty($value))
242 242
         {
243 243
             return;
244 244
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $length = strlen($value);
247 247
         
248 248
         // trimming underscores does not change the length: no underscores at start or end of string.
249
-        if(strlen(trim($value, '_')) === $length)
249
+        if (strlen(trim($value, '_')) === $length)
250 250
         {
251 251
             return;
252 252
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     private ?Mailcode_Commands_Command $sourceCommand = null;
58 58
 
59
-    public function __construct(string $statement, bool $freeform=false, ?Mailcode_Commands_Command $sourceCommand=null)
59
+    public function __construct(string $statement, bool $freeform = false, ?Mailcode_Commands_Command $sourceCommand = null)
60 60
     {
61 61
         $this->sourceCommand = $sourceCommand;
62 62
         $this->statement = $this->prepareStatement($statement);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     
107 107
     public function getInfo() : Mailcode_Parser_Statement_Info
108 108
     {
109
-        if($this->info instanceof Mailcode_Parser_Statement_Info)
109
+        if ($this->info instanceof Mailcode_Parser_Statement_Info)
110 110
         {
111 111
             return $this->info; 
112 112
         }
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     
119 119
     protected function validate() : void
120 120
     {
121
-        if($this->freeform)
121
+        if ($this->freeform)
122 122
         {
123 123
             return;
124 124
         }
125 125
 
126
-        if(!$this->tokenizer->hasTokens())
126
+        if (!$this->tokenizer->hasTokens())
127 127
         {
128 128
             $this->result->makeError(
129 129
                 t('Empty statement'),
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         
136 136
         $unknown = $this->tokenizer->getFirstUnknown();
137 137
         
138
-        if($unknown)
138
+        if ($unknown)
139 139
         {
140 140
             $this->result->makeError(
141 141
                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
Please login to merge, or discard this patch.
src/Mailcode/Parser/PreParser/CommandDef.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,11 +139,11 @@
 block discarded – undo
139 139
         $commands = $parser->getCommands();
140 140
         $content = $this->getContent();
141 141
 
142
-        foreach($commands as $command)
142
+        foreach ($commands as $command)
143 143
         {
144 144
             $string = $command->getOpeningText();
145 145
 
146
-            if(strpos($content, $string) !== false)
146
+            if (strpos($content, $string) !== false)
147 147
             {
148 148
                 $this->addEscapeError($command, $collection);
149 149
                 return false;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $placeholders = $this->getPlaceholdersCollection()->getAll();
175 175
         $string = $this->originalString;
176 176
         
177
-        foreach($placeholders as $placeholder)
177
+        foreach ($placeholders as $placeholder)
178 178
         {
179 179
             $string = $this->makePlaceholderSafe($string, $placeholder);
180 180
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         $pos = mb_strpos($string, $placeholder->getOriginalText());
190 190
 
191
-        if($pos === false)
191
+        if ($pos === false)
192 192
         {
193 193
             throw new Mailcode_Exception(
194 194
                 'Placeholder original text not found',
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     */
228 228
     public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting
229 229
     {
230
-        if(is_string($subject))
230
+        if (is_string($subject))
231 231
         {
232 232
             $subject = Mailcode::create()->createString($subject);
233 233
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     */
257 257
     public function getPlaceholdersCollection() : Mailcode_Parser_Safeguard_PlaceholderCollection
258 258
     {
259
-        if(isset($this->placeholders))
259
+        if (isset($this->placeholders))
260 260
         {
261 261
             return $this->placeholders;
262 262
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         $placeholders = array();
265 265
         $commands = $this->getCollection()->getCommands();
266 266
         
267
-        foreach($commands as $command)
267
+        foreach ($commands as $command)
268 268
         {
269 269
             self::$counter++;
270 270
             
@@ -287,21 +287,21 @@  discard block
 block discarded – undo
287 287
      * @return string
288 288
      * @throws Mailcode_Exception
289 289
      */
290
-    protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string
290
+    protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string
291 291
     {
292
-        if(!$partial)
292
+        if (!$partial)
293 293
         {
294 294
             $this->requireValidCollection();
295 295
         }
296 296
         
297 297
         $formatting = $this->createFormatting($string);
298 298
 
299
-        if($partial)
299
+        if ($partial)
300 300
         {
301 301
             $formatting->makePartial();
302 302
         }
303 303
         
304
-        if($highlighted)
304
+        if ($highlighted)
305 305
         {
306 306
             $formatting->replaceWithHTMLHighlighting();
307 307
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     */
398 398
     public function getCollection() : Mailcode_Collection
399 399
     {
400
-        if(isset($this->collection))
400
+        if (isset($this->collection))
401 401
         {
402 402
             return $this->collection;
403 403
         }
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     */
426 426
     protected function requireValidCollection() : void
427 427
     {
428
-        if($this->getCollection()->isValid())
428
+        if ($this->getCollection()->isValid())
429 429
         {
430 430
             return;
431 431
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/PlaceholderCollection.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function getByIndex(int $index) : Mailcode_Parser_Safeguard_Placeholder
41 41
     {
42
-        if(isset($this->placeholders[$index]))
42
+        if (isset($this->placeholders[$index]))
43 43
         {
44 44
             return $this->placeholders[$index];
45 45
         }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getByCommand(Mailcode_Commands_Command $command) : Mailcode_Parser_Safeguard_Placeholder
55 55
     {
56
-        foreach($this->placeholders as $placeholder)
56
+        foreach ($this->placeholders as $placeholder)
57 57
         {
58
-            if($placeholder->getCommand() === $command)
58
+            if ($placeholder->getCommand() === $command)
59 59
             {
60 60
                 return $placeholder;
61 61
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
79 79
     {
80
-        foreach($this->placeholders as $placeholder)
80
+        foreach ($this->placeholders as $placeholder)
81 81
         {
82
-            if($placeholder->getID() === $id)
82
+            if ($placeholder->getID() === $id)
83 83
             {
84 84
                 return $placeholder;
85 85
             }
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function getByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
106 106
     {
107
-        foreach($this->placeholders as $placeholder)
107
+        foreach ($this->placeholders as $placeholder)
108 108
         {
109
-            if($placeholder->getReplacementText() === $string)
109
+            if ($placeholder->getReplacementText() === $string)
110 110
             {
111 111
                 return $placeholder;
112 112
             }
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function getStrings() : array
131 131
     {
132
-        if(is_array($this->placeholderStrings))
132
+        if (is_array($this->placeholderStrings))
133 133
         {
134 134
             return $this->placeholderStrings;
135 135
         }
136 136
 
137 137
         $this->placeholderStrings = array();
138 138
 
139
-        foreach($this->placeholders as $placeholder)
139
+        foreach ($this->placeholders as $placeholder)
140 140
         {
141 141
             $this->placeholderStrings[] = $placeholder->getReplacementText();
142 142
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     */
46 46
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
47 47
     
48
-    public function if() : Mailcode_Factory_CommandSets_Set_If
48
+    public function if () : Mailcode_Factory_CommandSets_Set_If
49 49
     {
50
-        if(!isset($this->if))
50
+        if (!isset($this->if))
51 51
         {
52 52
             $this->if = new Mailcode_Factory_CommandSets_Set_If();
53 53
         }
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         return $this->if;
56 56
     }
57 57
     
58
-    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
58
+    public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
59 59
     {
60
-        if(!isset($this->elseIf))
60
+        if (!isset($this->elseIf))
61 61
         {
62 62
             $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
63 63
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     
68 68
     public function show() : Mailcode_Factory_CommandSets_Set_Show
69 69
     {
70
-        if(!isset($this->show))
70
+        if (!isset($this->show))
71 71
         {
72 72
             $this->show = new Mailcode_Factory_CommandSets_Set_Show();
73 73
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     
78 78
     public function misc() : Mailcode_Factory_CommandSets_Set_Misc
79 79
     {
80
-        if(!isset($this->misc))
80
+        if (!isset($this->misc))
81 81
         {
82 82
             $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
83 83
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     public function set() : Mailcode_Factory_CommandSets_Set_Set
89 89
     {
90
-        if(!isset($this->set))
90
+        if (!isset($this->set))
91 91
         {
92 92
             $this->set = new Mailcode_Factory_CommandSets_Set_Set();
93 93
         }
Please login to merge, or discard this patch.