Test Failed
Push — master ( 956a64...151bf3 )
by Sebastian
02:46
created
src/Mailcode/Variables/Variable.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     
77 77
     public function getFullName() : string
78 78
     {
79
-        if(empty($this->path))
79
+        if (empty($this->path))
80 80
         {
81 81
             return '$'.$this->name;
82 82
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     
102 102
     public function getHash() : string
103 103
     {
104
-        if(empty($this->hash))
104
+        if (empty($this->hash))
105 105
         {
106 106
             $this->hash = md5($this->matchedText);
107 107
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     
117 117
     public function getValidationResult() : OperationResult
118 118
     {
119
-        if(isset($this->validationResult))
119
+        if (isset($this->validationResult))
120 120
         {
121 121
             return $this->validationResult;
122 122
         }
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 
131 131
     protected function validate() : void
132 132
     {
133
-        foreach($this->validations as $validation)
133
+        foreach ($this->validations as $validation)
134 134
         {
135 135
             $method = 'validate_'.$validation;
136 136
             
137
-            if(!method_exists($this, $method))
137
+            if (!method_exists($this, $method))
138 138
             {
139 139
                 throw new Mailcode_Exception(
140 140
                     'Unknown validation method',
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             
150 150
             $this->$method();
151 151
             
152
-            if(!$this->validationResult->isValid())
152
+            if (!$this->validationResult->isValid())
153 153
             {
154 154
                 return;
155 155
             }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     
179 179
     protected function validateNumber(string $value, int $errorCode) : void
180 180
     {
181
-        if(!is_numeric(substr($value, 0, 1)))
181
+        if (!is_numeric(substr($value, 0, 1)))
182 182
         {
183 183
             return;
184 184
         }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     protected function validateUnderscore(string $value, int $errorCode) : void
197 197
     {
198 198
         // allow empty paths
199
-        if(empty($value))
199
+        if (empty($value))
200 200
         {
201 201
             return;
202 202
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         $length = strlen($value);
205 205
         
206 206
         // trimming underscores does not change the length: no underscores at start or end of string.
207
-        if(strlen(trim($value, '_')) == $length)
207
+        if (strlen(trim($value, '_')) == $length)
208 208
         {
209 209
             return;
210 210
         }
Please login to merge, or discard this patch.
src/Mailcode/Variables.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         $matches = array();
41 41
         preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER);
42 42
         
43
-        if(!isset($matches[0]) || empty($matches[0]))
43
+        if (!isset($matches[0]) || empty($matches[0]))
44 44
         {
45 45
             return $this->collection;
46 46
         }
47 47
         
48
-        foreach($matches[0] as $idx => $matchedText)
48
+        foreach ($matches[0] as $idx => $matchedText)
49 49
         {
50
-            if(!empty($matches[3][$idx]))
50
+            if (!empty($matches[3][$idx]))
51 51
             {
52 52
                 $this->addSingle($matches[3][$idx], $matchedText);
53 53
             }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function addSingle(string $name, string $matchedText) : void
64 64
     {
65 65
         // ignore US style numbers like $451
66
-        if(is_numeric($name))
66
+        if (is_numeric($name))
67 67
         {
68 68
             return;
69 69
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     protected function addPathed(string $path, string $name, string $matchedText) : void
75 75
     {
76 76
         // ignore US style numbers like $45.12
77
-        if(is_numeric($path.'.'.$name))
77
+        if (is_numeric($path.'.'.$name))
78 78
         {
79 79
             return;
80 80
         }
Please login to merge, or discard this patch.
src/Mailcode.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     */
74 74
     public function getParser() : Mailcode_Parser
75 75
     {
76
-        if(!isset($this->parser)) 
76
+        if (!isset($this->parser)) 
77 77
         {
78 78
             $this->parser = new Mailcode_Parser($this);
79 79
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     */
90 90
     public function getCommands() : Mailcode_Commands
91 91
     {
92
-        if(!isset($this->commands)) 
92
+        if (!isset($this->commands)) 
93 93
         {
94 94
             $this->commands = new Mailcode_Commands();
95 95
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function createVariables() : Mailcode_Variables
117 117
     {
118
-        if(!isset($this->variables))
118
+        if (!isset($this->variables))
119 119
         {
120 120
             $this->variables = new Mailcode_Variables();
121 121
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     */
132 132
     public function createTranslator() : Mailcode_Translator
133 133
     {
134
-        if(!isset($this->translator))
134
+        if (!isset($this->translator))
135 135
         {
136 136
             $this->translator = new Mailcode_Translator(); 
137 137
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         
74 74
         $total = count($matches[0]);
75 75
         
76
-        for($i=0; $i < $total; $i++)
76
+        for ($i = 0; $i < $total; $i++)
77 77
         {
78 78
             $match = $this->parseMatch($matches, $i);
79 79
             
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     
86 86
     protected function prepareString(string $subject) : string
87 87
     {
88
-        if(!ConvertHelper::isStringHTML($subject))
88
+        if (!ConvertHelper::isStringHTML($subject))
89 89
         {
90 90
             return $subject;
91 91
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $name = $match->getName();
108 108
         
109
-        if(!$this->commands->nameExists($name))
109
+        if (!$this->commands->nameExists($name))
110 110
         {
111 111
             $collection->addErrorMessage(
112 112
                 $match->getMatchedString(),
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $match->getMatchedString()
124 124
         );
125 125
         
126
-        if($cmd->isValid())
126
+        if ($cmd->isValid())
127 127
         {
128 128
             $collection->addCommand($cmd);
129 129
             return;
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
         // 5 = parameter type command, type
154 154
         // 6 = parameter type command, params
155 155
         
156
-        if(!empty($matches[1][$index]))
156
+        if (!empty($matches[1][$index]))
157 157
         {
158 158
             $name = $matches[1][$index];
159 159
         }
160
-        else if(!empty($matches[2][$index]))
160
+        else if (!empty($matches[2][$index]))
161 161
         {
162 162
             $name = $matches[2][$index];
163 163
             $params = $matches[3][$index];
164 164
         }
165
-        else if(!empty($matches[4][$index]))
165
+        else if (!empty($matches[4][$index]))
166 166
         {
167 167
             $name = $matches[4][$index];
168 168
             $type = $matches[5][$index];
Please login to merge, or discard this patch.
src/Mailcode/Renderer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     * @param bool $highlighted
33 33
     * @return Mailcode_Renderer
34 34
     */
35
-    public function setOutputHighlighted(bool $highlighted=true) : Mailcode_Renderer
35
+    public function setOutputHighlighted(bool $highlighted = true) : Mailcode_Renderer
36 36
     {
37 37
         $this->highlighted = $highlighted;
38 38
         
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         return $this->command2string(Mailcode_Factory::showSnippet($snippetName));
56 56
     }
57 57
     
58
-    public function setVar(string $variableName, string $value, bool $quoteValue=false) : string
58
+    public function setVar(string $variableName, string $value, bool $quoteValue = false) : string
59 59
     {
60 60
         return $this->command2string(Mailcode_Factory::setVar($variableName, $value, $quoteValue));
61 61
     }
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
         return $this->command2string(Mailcode_Factory::setVarString($variableName, $value));
66 66
     }
67 67
     
68
-    public function if(string $condition, string $type='') : string
68
+    public function if (string $condition, string $type = '') : string
69 69
     {
70
-        return $this->command2string(Mailcode_Factory::if($condition, $type));
70
+        return $this->command2string(Mailcode_Factory::if ($condition, $type));
71 71
     }
72 72
     
73
-    public function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string
73
+    public function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string
74 74
     {
75 75
         return $this->command2string(Mailcode_Factory::ifVar($variable, $operand, $value, $quoteValue));
76 76
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         return $this->command2string(Mailcode_Factory::ifVarString($variable, $operand, $value));
81 81
     }
82 82
     
83
-    public function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : string
83
+    public function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : string
84 84
     {
85 85
         return $this->command2string(Mailcode_Factory::ifVarEquals($variable, $value, $quoteValue));
86 86
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         return $this->command2string(Mailcode_Factory::ifVarEqualsString($variable, $value));    
91 91
     }
92 92
     
93
-    public function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string
93
+    public function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string
94 94
     {
95 95
         return $this->command2string(Mailcode_Factory::ifVarNotEquals($variable, $value, $quoteValue));
96 96
     }
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         return $this->command2string(Mailcode_Factory::ifVarNotEqualsString($variable, $value));
101 101
     }
102 102
     
103
-    public function elseIf(string $condition, string $type='') : string
103
+    public function elseIf (string $condition, string $type = '') : string
104 104
     {
105
-        return $this->command2string(Mailcode_Factory::elseIf($condition, $type));
105
+        return $this->command2string(Mailcode_Factory::elseIf ($condition, $type));
106 106
     }
107 107
     
108
-    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : string
108
+    public function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : string
109 109
     {
110 110
         return $this->command2string(Mailcode_Factory::elseIfVar($variable, $operand, $value, $quoteValue));
111 111
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         return $this->command2string(Mailcode_Factory::elseIfVarString($variable, $operand, $value));
116 116
     }
117 117
     
118
-    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : string
118
+    public function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : string
119 119
     {
120 120
         return $this->command2string(Mailcode_Factory::elseIfVarEquals($variable, $value, $quoteValue));
121 121
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         return $this->command2string(Mailcode_Factory::elseIfVarEqualsString($variable, $value));
126 126
     }
127 127
     
128
-    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : string
128
+    public function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : string
129 129
     {
130 130
         return $this->command2string(Mailcode_Factory::elseIfVarNotEquals($variable, $value, $quoteValue));
131 131
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     
153 153
     protected function command2string(Mailcode_Commands_Command $command) : string
154 154
     {
155
-        if($this->highlighted)
155
+        if ($this->highlighted)
156 156
         {
157 157
             return $command->getHighlighted();
158 158
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $command->getID()
65 65
         );
66 66
         
67
-        if(!class_exists($class))
67
+        if (!class_exists($class))
68 68
         {
69 69
             throw new Mailcode_Translator_Exception(
70 70
                 sprintf('Unknown command %s in translator', $command->getID()),
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $subject = $safeguard->makeSafe();
94 94
         
95
-        if(!$safeguard->hasPlaceholders())
95
+        if (!$safeguard->hasPlaceholders())
96 96
         {
97 97
             return $subject;
98 98
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         
102 102
         $replaces = array();
103 103
         
104
-        foreach($placeholders as $placeholder)
104
+        foreach ($placeholders as $placeholder)
105 105
         {
106 106
             $replaces[$placeholder->getReplacementText()] = $this->translateCommand($placeholder->getCommand());
107 107
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ShowDate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@
 block discarded – undo
56 56
         $chars = ConvertHelper::string2array($formatString);
57 57
         $result = array();
58 58
         
59
-        foreach($chars as $char)
59
+        foreach ($chars as $char)
60 60
         {
61
-            if(!isset($this->charTable[$char]))
61
+            if (!isset($this->charTable[$char]))
62 62
             {
63 63
                 throw new Mailcode_Translator_Exception(
64 64
                     'Unknown date format string character',
Please login to merge, or discard this patch.
src/Mailcode/Date/FormatInfo/Character.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
     */
88 88
     public function getTypeLabel() : string
89 89
     {
90
-        switch($this->type)
90
+        switch ($this->type)
91 91
         {
92 92
             case Mailcode_Date_FormatInfo::CHARTYPE_DATE:
93 93
                 return t('Date');
Please login to merge, or discard this patch.
src/Mailcode/Date/FormatInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     
59 59
     public static function getInstance() : Mailcode_Date_FormatInfo
60 60
     {
61
-        if(!isset(self::$instance))
61
+        if (!isset(self::$instance))
62 62
         {
63 63
             self::$instance = new Mailcode_Date_FormatInfo();
64 64
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             array(self::CHARTYPE_PUNCTUATION, ' ', t('Space'))
91 91
         );
92 92
         
93
-        foreach($chars as $def)
93
+        foreach ($chars as $def)
94 94
         {
95 95
             $char = new Mailcode_Date_FormatInfo_Character(
96 96
                 $def[0],
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         
130 130
         $trimmed = trim($formatString);
131 131
         
132
-        if(empty($trimmed))
132
+        if (empty($trimmed))
133 133
         {
134 134
             $result->makeError(
135 135
                 t('Empty date format.'),
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
         $chars = ConvertHelper::string2array($formatString);
143 143
         $total = count($chars);
144 144
         
145
-        for($i=0; $i < $total; $i++)
145
+        for ($i = 0; $i < $total; $i++)
146 146
         {
147 147
             $char = $chars[$i];
148 148
             
149
-            if(!in_array($char, $this->allowedChars))
149
+            if (!in_array($char, $this->allowedChars))
150 150
             {
151 151
                 $result->makeError(
152 152
                     t('Invalid character in date format:').' '.
153
-                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i+1),
153
+                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1),
154 154
                     self::VALIDATION_INVALID_FORMAT_CHARACTER
155 155
                 );
156 156
                 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $grouped = array();
184 184
         
185
-        foreach($this->formatChars as $char)
185
+        foreach ($this->formatChars as $char)
186 186
         {
187 187
             $type = $char->getTypeLabel();
188 188
             
189
-            if(!isset($grouped[$type]))
189
+            if (!isset($grouped[$type]))
190 190
             {
191 191
                 $grouped[$type] = array();
192 192
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
         $groups = array_keys($grouped);
198 198
         
199
-        foreach($groups as $group)
199
+        foreach ($groups as $group)
200 200
         {
201 201
             usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b)
202 202
             {
Please login to merge, or discard this patch.