Passed
Push — master ( 174259...689687 )
by Sebastian
04:01
created
src/Mailcode/Collection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         $errors = $this->errors;
101 101
         
102
-        if(!$result->isValid())
102
+        if (!$result->isValid())
103 103
         {
104 104
             $errors[] = new Mailcode_Collection_Error_Message(
105 105
                 '',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $errors = $this->getErrors();
117 117
         
118
-        if(!empty($errors))
118
+        if (!empty($errors))
119 119
         {
120 120
             return array_shift($errors);
121 121
         }
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $hashes = array();
159 159
         
160
-        foreach($this->commands as $command)
160
+        foreach ($this->commands as $command)
161 161
         {
162 162
             $hash = $command->getHash();
163 163
             
164
-            if(!isset($hashes[$hash]))
164
+            if (!isset($hashes[$hash]))
165 165
             {
166 166
                 $hashes[$hash] = $command;
167 167
             }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     */
179 179
     public function addCommands(array $commands) : Mailcode_Collection
180 180
     {
181
-        foreach($commands as $command)
181
+        foreach ($commands as $command)
182 182
         {
183 183
             $this->addCommand($command);
184 184
         }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     {
198 198
         $collection = new Mailcode_Variables_Collection_Regular();
199 199
         
200
-        foreach($this->commands as $command)
200
+        foreach ($this->commands as $command)
201 201
         {
202 202
             $collection->mergeWith($command->getVariables());
203 203
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     
208 208
     public function getValidationResult() : OperationResult
209 209
     {
210
-        if(isset($this->validationResult))
210
+        if (isset($this->validationResult))
211 211
         {
212 212
             return $this->validationResult;
213 213
         }
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $errors = $this->getErrors();
225 225
         
226
-        foreach($errors as $error)
226
+        foreach ($errors as $error)
227 227
         {
228
-            if($error->getCode() === $code)
228
+            if ($error->getCode() === $code)
229 229
             {
230 230
                 return true;
231 231
             }
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $result = array();
245 245
         
246
-        foreach($this->commands as $command)
246
+        foreach ($this->commands as $command)
247 247
         {
248
-            if($command instanceof Mailcode_Commands_Command_ShowVariable)
248
+            if ($command instanceof Mailcode_Commands_Command_ShowVariable)
249 249
             {
250 250
                 $result[] = $command;
251 251
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $commands = $this->getCommands();
260 260
         
261
-        if(!empty($commands))
261
+        if (!empty($commands))
262 262
         {
263 263
             return array_shift($commands);
264 264
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Highlighter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $this->parts[] = $this->renderTag(array('command-name'), $this->command->getName());
53 53
         
54
-        if($this->command->hasType())
54
+        if ($this->command->hasType())
55 55
         {
56 56
             $this->parts[] = ' '.$this->renderTag(array('command-type'), $this->command->getType());
57 57
         }
58 58
         
59
-        if($this->command->requiresParameters())
59
+        if ($this->command->requiresParameters())
60 60
         {
61 61
             $this->parts[] = $this->renderTag(array('hyphen'), ':');
62 62
             $this->parts[] = '<wbr>';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     
66 66
     protected function appendParams() : void
67 67
     {
68
-        if($this->command->hasParameters())
68
+        if ($this->command->hasParameters())
69 69
         {
70 70
             $this->parts[] = ' '.$this->renderTag(array('params'), $this->command->getParamsString());
71 71
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $parts = array();
82 82
         
83
-        foreach($classes as $class)
83
+        foreach ($classes as $class)
84 84
         {
85 85
             $parts[] = 'mailcode-'.$class;
86 86
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfVariable.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         
54 54
         $var = $info->getVariableByIndex(0);
55 55
         
56
-        if($var)
56
+        if ($var)
57 57
         {
58 58
             $this->variable = $var;
59 59
             return;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         
72 72
         $operand = $info->getOperandByIndex(1);
73 73
         
74
-        if(!$operand)
74
+        if (!$operand)
75 75
         {
76 76
             $this->validationResult->makeError(
77 77
                 t('No operand sign after the variable name.'),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             return;
82 82
         }
83 83
         
84
-        if(!$operand->isComparator())
84
+        if (!$operand->isComparator())
85 85
         {
86 86
             $this->validationResult->makeError(
87 87
                 t('The operand sign is not a comparison operand.'),
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         
101 101
         $token = $info->getTokenByIndex(2);
102 102
         
103
-        if(!$token)
103
+        if (!$token)
104 104
         {
105 105
             $this->validationResult->makeError(
106 106
                 t('Nothing found after the comparison operand.'),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             return;
111 111
         }
112 112
         
113
-        if($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
113
+        if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
114 114
         {
115 115
             $this->value = $token;
116 116
             
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     */
131 131
     public function getVariable() : Mailcode_Variables_Variable
132 132
     {
133
-        if(isset($this->variable))
133
+        if (isset($this->variable))
134 134
         {
135 135
             return $this->variable->getVariable();
136 136
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     
145 145
     public function getComparator() : string
146 146
     {
147
-        if(!isset($this->comparator))
147
+        if (!isset($this->comparator))
148 148
         {
149 149
             throw new Mailcode_Exception(
150 150
                 'No comparator available',
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfContains.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         
53 53
         $variable = $info->getVariableByIndex(0);
54 54
         
55
-        if($variable)
55
+        if ($variable)
56 56
         {
57 57
             $this->variable = $variable;
58 58
             return;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         // first variant: variable "Search term"
72 72
         $string = $info->getStringLiteralByIndex(1);
73 73
         
74
-        if($string)
74
+        if ($string)
75 75
         {
76 76
             $this->literal = $string;
77 77
             return;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         // second variant: variable insensitive: "Search term"
88 88
         $keyword = $info->getKeywordByIndex(1);
89 89
         
90
-        if(!$keyword)
90
+        if (!$keyword)
91 91
         {
92 92
             $this->validationResult->makeError(
93 93
                 t('Expected a search term or the %1$s keyword after the variable name.', 'insensitive:'),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             return;
98 98
         }
99 99
         
100
-        if($keyword->getKeyword() !== 'insensitive:')
100
+        if ($keyword->getKeyword() !== 'insensitive:')
101 101
         {
102 102
             $this->validationResult->makeError(
103 103
                 t('Invalid keyword %1$s.', $keyword->getKeyword()).' '.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         
120 120
         $string = $info->getStringLiteralByIndex(2);
121 121
         
122
-        if($string)
122
+        if ($string)
123 123
         {
124 124
             $this->literal = $string;
125 125
             return;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     */
139 139
     public function getVariable() : Mailcode_Variables_Variable
140 140
     {
141
-        if(isset($this->variable))
141
+        if (isset($this->variable))
142 142
         {
143 143
             return $this->variable->getVariable();
144 144
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     
158 158
     public function getSearchTerm() : string
159 159
     {
160
-        if(!isset($this->literal))
160
+        if (!isset($this->literal))
161 161
         {
162 162
             throw new Mailcode_Exception(
163 163
                 'No string literal available',
Please login to merge, or discard this patch.
src/Mailcode/Commands.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         static $ids = array();
46 46
         
47
-        if(empty($ids)) {
47
+        if (empty($ids)) {
48 48
             $ids = \AppUtils\FileHelper::createFileFinder(__DIR__.'/Commands/Command')
49 49
             ->getPHPClassNames();
50 50
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     */
62 62
     public function getAll()
63 63
     {
64
-        if(!empty($this->commands)) {
64
+        if (!empty($this->commands)) {
65 65
             return $this->commands;
66 66
         }
67 67
         
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         
70 70
         $result = array();
71 71
         
72
-        foreach($ids as $id) 
72
+        foreach ($ids as $id) 
73 73
         {
74 74
             $result[] = $this->getDummyCommand($id);
75 75
         }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         static $instances = array();
96 96
         
97
-        if(!isset($instances[$id])) 
97
+        if (!isset($instances[$id])) 
98 98
         {
99 99
             $instances[$id] = $this->createCommand($id, '__dummy', '', '');
100 100
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $items = $this->getAll();
117 117
         
118
-        foreach($items as $item) 
118
+        foreach ($items as $item) 
119 119
         {
120
-            if($item->getName() === $name) {
120
+            if ($item->getName() === $name) {
121 121
                 return $item->getID();
122 122
             }
123 123
         }
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $items = $this->getAll();
151 151
         
152
-        foreach($items as $item)
152
+        foreach ($items as $item)
153 153
         {
154
-            if($item->getName() === $name) {
154
+            if ($item->getName() === $name) {
155 155
                 return true;
156 156
             }
157 157
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     {
164 164
         $class = $this->resolveClassName($id, $type);
165 165
         
166
-        if(!class_exists($class))
166
+        if (!class_exists($class))
167 167
         {
168 168
             throw new Mailcode_Exception(
169 169
                 'No such command',
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
         
186 186
         $dummy = $this->getDummyCommand($id);
187 187
         
188
-        if($dummy->supportsType())
188
+        if ($dummy->supportsType())
189 189
         {
190
-            if(empty($type))
190
+            if (empty($type))
191 191
             {
192 192
                 $type = $dummy->getDefaultType();
193 193
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     */
208 208
     private function getDummyCommand(string $id) : Mailcode_Commands_Command
209 209
     {
210
-        if(!isset(self::$dummyCommands[$id]))
210
+        if (!isset(self::$dummyCommands[$id]))
211 211
         {
212 212
             $class = 'Mailcode\Mailcode_Commands_Command_'.$id;
213 213
             self::$dummyCommands[$id] = new $class('__dummy');
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             ')'
49 49
         );
50 50
         
51
-        foreach($escape as $char)
51
+        foreach ($escape as $char)
52 52
         {
53 53
             $string = str_replace($char, '\\'.$char, $string);
54 54
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/If.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public function translate(Mailcode_Commands_Command_If $command): string
24 24
     {
25
-        if($command instanceof Mailcode_Commands_Command_If_Command)
25
+        if ($command instanceof Mailcode_Commands_Command_If_Command)
26 26
         {
27 27
             return $this->translateCommand($command);
28 28
         }
29 29
         
30
-        if($command instanceof Mailcode_Commands_Command_If_Variable)
30
+        if ($command instanceof Mailcode_Commands_Command_If_Variable)
31 31
         {
32 32
             return $this->translateVariable($command);
33 33
         }
34 34
         
35
-        if($command instanceof Mailcode_Commands_Command_If_Contains)
35
+        if ($command instanceof Mailcode_Commands_Command_If_Contains)
36 36
         {
37 37
             return $this->translateContains($command);
38 38
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $params = $command->getParams();
46 46
         
47
-        if(!$params)
47
+        if (!$params)
48 48
         {
49 49
             return '';
50 50
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     protected function translateContains(Mailcode_Commands_Command_If_Contains $command) : string
69 69
     {
70 70
         $opts = 's';
71
-        if($command->isCaseInsensitive())
71
+        if ($command->isCaseInsensitive())
72 72
         {
73 73
             $opts = 'is';
74 74
         }
Please login to merge, or discard this patch.
src/Mailcode/Translator/Syntax/ApacheVelocity/ElseIf.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public function translate(Mailcode_Commands_Command_ElseIf $command): string
24 24
     {
25
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Command)
25
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Command)
26 26
         {
27 27
             return $this->translateCommand($command);
28 28
         }
29 29
         
30
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
30
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Variable)
31 31
         {
32 32
             return $this->translateVariable($command);
33 33
         }
34 34
         
35
-        if($command instanceof Mailcode_Commands_Command_ElseIf_Contains)
35
+        if ($command instanceof Mailcode_Commands_Command_ElseIf_Contains)
36 36
         {
37 37
             return $this->translateContains($command);
38 38
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $params = $command->getParams();
46 46
         
47
-        if(!$params)
47
+        if (!$params)
48 48
         {
49 49
             return '';
50 50
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     protected function translateContains(Mailcode_Commands_Command_ElseIf_Contains $command) : string
69 69
     {
70 70
         $opts = 's';
71
-        if($command->isCaseInsensitive())
71
+        if ($command->isCaseInsensitive())
72 72
         {
73 73
             $opts = 'is';
74 74
         }
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.