Test Failed
Push — master ( 36c5b6...af11e6 )
by Sebastian
04:51
created
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/Translator/Syntax/ApacheVelocity.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         
70 70
         // All other special characters have to be escaped
71 71
         // with two backslashes. 
72
-        foreach($this->regexSpecialChars as $char)
72
+        foreach ($this->regexSpecialChars as $char)
73 73
         {
74 74
             $string = str_replace($char, '\\'.$char, $string);
75 75
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     protected function addURLEncoding(Mailcode_Commands_Command $command, string $statement) : string
85 85
     {
86
-        if($command->isURLEncoded())
86
+        if ($command->isURLEncoded())
87 87
         {
88 88
             return sprintf(
89 89
                 '${esc.url($%s)}',
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             );
92 92
         }
93 93
 
94
-        if($command->isURLDecoded())
94
+        if ($command->isURLDecoded())
95 95
         {
96 96
             return sprintf(
97 97
                 '${esc.unurl($%s)}',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         $varName = '$'.ltrim($varName, '$');
111 111
 
112
-        if($absolute)
112
+        if ($absolute)
113 113
         {
114 114
             $varName = sprintf('${price.abs(%s)}', $varName);
115 115
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/StringPreProcessor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function stripStyleTags() : void
64 64
     {
65
-        if(!ConvertHelper::isStringHTML($this->subject))
65
+        if (!ConvertHelper::isStringHTML($this->subject))
66 66
         {
67 67
             return;
68 68
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     private function replaceBrackets(string $subject, string $needle) : string
78 78
     {
79
-        $replacement =  str_replace(
79
+        $replacement = str_replace(
80 80
             array('{', '}'),
81 81
             array(
82 82
                 self::LITERAL_BRACKET_LEFT_REPLACEMENT,
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $subject
47 47
      * @param Mailcode_Commands_Command|null $sourceCommand
48 48
      */
49
-    public function __construct(string $tokenID, string $matchedText, $subject=null, ?Mailcode_Commands_Command $sourceCommand=null)
49
+    public function __construct(string $tokenID, string $matchedText, $subject = null, ?Mailcode_Commands_Command $sourceCommand = null)
50 50
     {
51 51
         $this->tokenID = $tokenID;
52 52
         $this->matchedText = $matchedText;
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
         return $this->matchedText;
87 87
     }
88 88
     
89
-    protected function restoreQuotes(string $subject, bool $escaped=true) : string
89
+    protected function restoreQuotes(string $subject, bool $escaped = true) : string
90 90
     {
91 91
         $replace = '\"';
92 92
 
93
-        if(!$escaped)
93
+        if (!$escaped)
94 94
         {
95 95
             $replace = '"';
96 96
         }
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/PreParser.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public static function getContent(int $id) : string
113 113
     {
114
-        if(isset(self::$contents[$id]))
114
+        if (isset(self::$contents[$id]))
115 115
         {
116 116
             return self::$contents[$id];
117 117
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public static function clearContent(int $id) : void
136 136
     {
137
-        if(isset(self::$contents[$id]))
137
+        if (isset(self::$contents[$id]))
138 138
         {
139 139
             unset(self::$contents[$id]);
140 140
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         $names = $this->getContentCommandNames();
157 157
 
158
-        foreach($names as $name)
158
+        foreach ($names as $name)
159 159
         {
160 160
             $this->collapseContentCommand($name);
161 161
         }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $commands = Mailcode::create()->getCommands()->getContentCommands();
175 175
         $result = array();
176 176
 
177
-        foreach($commands as $command)
177
+        foreach ($commands as $command)
178 178
         {
179 179
             $result[] = $command->getName();
180 180
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $this->commands = $this->detectCommands($name);
247 247
 
248
-        foreach($this->commands as $commandDef)
248
+        foreach ($this->commands as $commandDef)
249 249
         {
250 250
             $this->processCommand($commandDef);
251 251
         }
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 
256 256
     private function validateCommandContents() : void
257 257
     {
258
-        foreach($this->commands as $command)
258
+        foreach ($this->commands as $command)
259 259
         {
260
-            if(!$command->validateContent($this, $this->collection))
260
+            if (!$command->validateContent($this, $this->collection))
261 261
             {
262 262
                 return;
263 263
             }
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
     {
272 272
         $openingCommands = $this->detectOpeningCommands($name);
273 273
 
274
-        if(empty($openingCommands))
274
+        if (empty($openingCommands))
275 275
         {
276 276
             return array();
277 277
         }
278 278
 
279 279
         $closingCommands = $this->detectClosingCommands($name);
280 280
 
281
-        if(count($closingCommands) !== count($openingCommands))
281
+        if (count($closingCommands) !== count($openingCommands))
282 282
         {
283 283
             $this->addClosingError($name);
284 284
             return array();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
         $result = array();
288 288
 
289
-        foreach($openingCommands as $idx => $def)
289
+        foreach ($openingCommands as $idx => $def)
290 290
         {
291 291
             $result[] = new Mailcode_PreParser_CommandDef(
292 292
                 $name,
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      */
329 329
     private function debugOpeningCommands(array $matches) : void
330 330
     {
331
-        if($this->debug === false)
331
+        if ($this->debug === false)
332 332
         {
333 333
             return;
334 334
         }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
     private function debugCommandDef(Mailcode_PreParser_CommandDef $commandDef) : void
384 384
     {
385
-        if($this->debug === true)
385
+        if ($this->debug === true)
386 386
         {
387 387
             echo 'Command definition:'.PHP_EOL;
388 388
             print_r($commandDef->toArray());
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.