Passed
Push — master ( 2f714f...1c67eb )
by Sebastian
02:15
created
src/functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
  */
24 24
 function init() : void
25 25
 {
26
-    if(!class_exists('\AppLocalize\Localization')) {
26
+    if (!class_exists('\AppLocalize\Localization')) {
27 27
         return;
28 28
     }
29 29
     
Please login to merge, or discard this patch.
src/Mailcode/Collection/NestingValidator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
         
61 61
         $commands = $this->collection->getCommands();
62 62
         
63
-        foreach($commands as $command)
63
+        foreach ($commands as $command)
64 64
         {
65 65
             $method = 'validate_'.$command->getCommandType();
66 66
             
67
-            if(!method_exists($this, $method))
67
+            if (!method_exists($this, $method))
68 68
             {
69 69
                 throw new Mailcode_Exception(
70 70
                     'Unknown command type validation method.',
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             
80 80
             $this->$method($command);
81 81
             
82
-            if(!$this->validationResult->isValid())
82
+            if (!$this->validationResult->isValid())
83 83
             {
84 84
                 break;
85 85
             }
86 86
         }
87 87
         
88
-        if($this->validationResult->isValid())
88
+        if ($this->validationResult->isValid())
89 89
         {
90 90
             $this->validate_Unclosed();
91 91
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $leftover = $this->getOpenCommand();
99 99
         
100
-        if($leftover === null)
100
+        if ($leftover === null)
101 101
         {
102 102
             return;
103 103
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     
114 114
     protected function getOpenCommand() : ?Mailcode_Commands_Command_Type_Opening
115 115
     {
116
-        if(empty($this->stack))
116
+        if (empty($this->stack))
117 117
         {
118 118
             return null;
119 119
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         
125 125
         $cmd = $this->stack[$idx];
126 126
         
127
-        if($cmd instanceof Mailcode_Commands_Command_Type_Opening)
127
+        if ($cmd instanceof Mailcode_Commands_Command_Type_Opening)
128 128
         {
129 129
             return $cmd;
130 130
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $parent = $this->getOpenCommand();
150 150
         
151
-        if($parent === null)
151
+        if ($parent === null)
152 152
         {
153 153
             $this->validationResult->makeError(
154 154
                 t(
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             return;
163 163
         }
164 164
         
165
-        if($parent->getName() !== $command->getParentName())
165
+        if ($parent->getName() !== $command->getParentName())
166 166
         {
167 167
             $this->validationResult->makeError(
168 168
                 t(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     
182 182
     protected function validate_Closing(Mailcode_Commands_Command_Type_Closing $command) : void
183 183
     {
184
-        if(empty($this->stack))
184
+        if (empty($this->stack))
185 185
         {
186 186
             $this->validationResult->makeError(
187 187
                 t('All open commands have already been ended.'),
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
     * 
57 57
     * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
58 58
     */
59
-    public static function setVariable(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable
59
+    public static function setVariable(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable
60 60
     {
61 61
         $variableName = self::_filterVariableName($variableName);
62 62
         
63
-        if($quoteValue)
63
+        if ($quoteValue)
64 64
         {
65 65
             $value = self::_quoteString($value);
66 66
         }
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
         return $cmd;
121 121
     }
122 122
     
123
-    protected static function _buildIf(string $cmd, string $condition, string $type='') : Mailcode_Commands_Command
123
+    protected static function _buildIf(string $cmd, string $condition, string $type = '') : Mailcode_Commands_Command
124 124
     {
125 125
         $stringType = $type;
126 126
         
127
-        if(!empty($type))
127
+        if (!empty($type))
128 128
         {
129 129
             $stringType = ' '.$type;
130 130
         }
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         return $cmd;
148 148
     }
149 149
   
150
-    protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command
150
+    protected static function _buildIfVar(string $cmd, string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command
151 151
     {
152
-        if($quoteValue)
152
+        if ($quoteValue)
153 153
         {
154 154
             $value = self::_quoteString($value);
155 155
         }
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
         return self::_buildIf($cmd, $condition, 'variable');
165 165
     }
166 166
     
167
-    public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If
167
+    public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If
168 168
     {
169 169
         $cmd = self::_buildIf('If', $condition, $type);
170 170
         
171
-        if($cmd instanceof Mailcode_Commands_Command_If)
171
+        if ($cmd instanceof Mailcode_Commands_Command_If)
172 172
         {
173 173
             return $cmd;
174 174
         }
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
         throw self::_exceptionUnexpectedType($cmd);
177 177
     }
178 178
     
179
-    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
179
+    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
180 180
     {
181 181
         $cmd = self::_buildIfVar('If', $variable, $operand, $value, $quoteValue);
182 182
         
183
-        if($cmd instanceof Mailcode_Commands_Command_If)
183
+        if ($cmd instanceof Mailcode_Commands_Command_If)
184 184
         {
185 185
             return $cmd;
186 186
         }
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
         throw self::_exceptionUnexpectedType($cmd);
189 189
     }
190 190
     
191
-    public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
191
+    public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
192 192
     {
193 193
         $cmd = self::_buildIfVar('If', $variable, '==', $value, $quoteValue);
194 194
         
195
-        if($cmd instanceof Mailcode_Commands_Command_If)
195
+        if ($cmd instanceof Mailcode_Commands_Command_If)
196 196
         {
197 197
             return $cmd;
198 198
         }
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
         throw self::_exceptionUnexpectedType($cmd);
201 201
     }
202 202
     
203
-    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If
203
+    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If
204 204
     {
205 205
         $cmd = self::_buildIfVar('If', $variable, '!=', $value, $quoteValue);
206 206
         
207
-        if($cmd instanceof Mailcode_Commands_Command_If)
207
+        if ($cmd instanceof Mailcode_Commands_Command_If)
208 208
         {
209 209
             return $cmd;
210 210
         }
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
         throw self::_exceptionUnexpectedType($cmd);
213 213
     }
214 214
     
215
-    public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf
215
+    public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf
216 216
     {
217 217
         $cmd = self::_buildIf('ElseIf', $condition, $type);
218 218
         
219
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
219
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
220 220
         {
221 221
             return $cmd;
222 222
         }
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
         throw self::_exceptionUnexpectedType($cmd);
225 225
     }
226 226
     
227
-    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
227
+    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
228 228
     {
229 229
         $cmd = self::_buildIfVar('ElseIf', $variable, $operand, $value, $quoteValue);
230 230
         
231
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
231
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
232 232
         {
233 233
             return $cmd;
234 234
         }
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
         throw self::_exceptionUnexpectedType($cmd);
237 237
     }
238 238
     
239
-    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
239
+    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
240 240
     {
241 241
         $cmd = self::_buildIfVar('ElseIf', $variable, '==', $value, $quoteValue);
242 242
         
243
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
243
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
244 244
         {
245 245
             return $cmd;
246 246
         }
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
         throw self::_exceptionUnexpectedType($cmd);
249 249
     }
250 250
     
251
-    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf
251
+    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf
252 252
     {
253 253
         $cmd = self::_buildIfVar('ElseIf', $variable, '!=', $value, $quoteValue);
254 254
         
255
-        if($cmd instanceof Mailcode_Commands_Command_ElseIf)
255
+        if ($cmd instanceof Mailcode_Commands_Command_ElseIf)
256 256
         {
257 257
             return $cmd;
258 258
         }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     
279 279
     protected static function _checkCommand(Mailcode_Commands_Command $command) : void
280 280
     {
281
-        if($command->isValid())
281
+        if ($command->isValid())
282 282
         {
283 283
             return;
284 284
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         'type_unsupported'
75 75
     );
76 76
     
77
-    public function __construct(string $type='', string $paramsString='', string $matchedText='')
77
+    public function __construct(string $type = '', string $paramsString = '', string $matchedText = '')
78 78
     {
79 79
         $this->type = $type;
80 80
         $this->paramsString = $paramsString;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $this->requireNonDummy();
122 122
         
123
-        if($this->hash === '') {
123
+        if ($this->hash === '') {
124 124
             $this->hash = md5($this->matchedText);
125 125
         }
126 126
         
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     
130 130
     protected function requireNonDummy() : void
131 131
     {
132
-        if(!$this->isDummy())
132
+        if (!$this->isDummy())
133 133
         {
134 134
             return;
135 135
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $this->requireNonDummy();
152 152
         
153
-        if(isset($this->validationResult)) 
153
+        if (isset($this->validationResult)) 
154 154
         {
155 155
             return $this->validationResult;
156 156
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     
165 165
     public function getValidationResult() :  \AppUtils\OperationResult
166 166
     {
167
-        if(isset($this->validationResult)) 
167
+        if (isset($this->validationResult)) 
168 168
         {
169 169
             return $this->validationResult;
170 170
         }
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $validations = array_merge($this->validations, $this->getValidations());
182 182
         
183
-        foreach($validations as $validation)
183
+        foreach ($validations as $validation)
184 184
         {
185 185
             $method = 'validateSyntax_'.$validation;
186 186
             
187
-            if(!method_exists($this, $method))
187
+            if (!method_exists($this, $method))
188 188
             {
189 189
                 throw new Mailcode_Exception(
190 190
                     'Missing validation method',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             $this->$method();
201 201
             
202 202
             // break off at the first validation issue
203
-            if(!$this->validationResult->isValid())
203
+            if (!$this->validationResult->isValid())
204 204
             {
205 205
                 return;
206 206
             }
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
     
215 215
     protected function validateSyntax_params() : void
216 216
     {
217
-        if(!$this->requiresParameters())
217
+        if (!$this->requiresParameters())
218 218
         {
219 219
             return;
220 220
         }
221 221
         
222
-        if(empty($this->paramsString))
222
+        if (empty($this->paramsString))
223 223
         {
224 224
             $this->validationResult->makeError(
225 225
                 t('Parameters have to be specified.'),
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         
231 231
         $this->params = $this->mailcode->getParser()->createStatement($this->paramsString);
232 232
         
233
-        if(!$this->params->isValid())
233
+        if (!$this->params->isValid())
234 234
         {
235 235
             $error = $this->params->getValidationResult();
236 236
             
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
     
244 244
     protected function validateSyntax_type_supported() : void
245 245
     {
246
-        if(!$this->supportsType() || empty($this->type))
246
+        if (!$this->supportsType() || empty($this->type))
247 247
         {
248 248
             return;
249 249
         }
250 250
         
251 251
         $types = $this->getSupportedTypes();
252 252
 
253
-        if(!in_array($this->type, $types))
253
+        if (!in_array($this->type, $types))
254 254
         {
255 255
             $this->validationResult->makeError(
256 256
                 t('The command addon %1$s is not supported.', $this->type).' '.
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     
265 265
     protected function validateSyntax_type_unsupported() : void
266 266
     {
267
-        if($this->supportsType() || empty($this->type))
267
+        if ($this->supportsType() || empty($this->type))
268 268
         {
269 269
             return;
270 270
         }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     
283 283
     public function getType() : string
284 284
     {
285
-        if($this->supportsType())
285
+        if ($this->supportsType())
286 286
         {
287 287
             return $this->type;
288 288
         }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     
303 303
     public function getHighlighted() : string
304 304
     {
305
-        if(!$this->isValid())
305
+        if (!$this->isValid())
306 306
         {
307 307
             return '';
308 308
         }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     
314 314
     public function getParamsString() : string
315 315
     {
316
-        if($this->requiresParameters())
316
+        if ($this->requiresParameters())
317 317
         {
318 318
             return $this->paramsString;
319 319
         }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     
341 341
     public function getNormalized() : string
342 342
     {
343
-        if(!$this->isValid())
343
+        if (!$this->isValid())
344 344
         {
345 345
             return '';
346 346
         }
@@ -348,12 +348,12 @@  discard block
 block discarded – undo
348 348
         $parts = array();
349 349
         $parts[] = '{'.$this->getName();
350 350
         
351
-        if($this->supportsType() && $this->hasType())
351
+        if ($this->supportsType() && $this->hasType())
352 352
         {
353 353
             $parts[] = ' '.$this->getType();
354 354
         }
355 355
         
356
-        if($this->requiresParameters() && isset($this->params))
356
+        if ($this->requiresParameters() && isset($this->params))
357 357
         {
358 358
             $parts[] = ': ';
359 359
             $parts[] = $this->params->getNormalized();
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/SetVariable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $variable = $this->params->getInfo()->getVariableByIndex(0);
60 60
         
61
-        if($variable)
61
+        if ($variable)
62 62
         {
63 63
             return $variable->getVariable();
64 64
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     
87 87
     protected function validateSyntax_assignment() : void
88 88
     {
89
-        if($this->params->getInfo()->isVariableAssignment())
89
+        if ($this->params->getInfo()->isVariableAssignment())
90 90
         {
91 91
             return;
92 92
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/Comment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     protected function init() : void
24 24
     {
25 25
         // automatically quote the parameters, since comments don't require any.
26
-        if(!strstr($this->paramsString, '"'))
26
+        if (!strstr($this->paramsString, '"'))
27 27
         {
28 28
             $this->paramsString = '"'.$this->paramsString.'"';
29 29
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/ShowVariable.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
         $this->validate();
64 64
         
65
-        if(isset($this->variable))
65
+        if (isset($this->variable))
66 66
         {
67 67
             return $this->variable;
68 68
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
          $vars = $this->getVariables()->getGroupedByName();
94 94
          $amount = count($vars);
95 95
          
96
-         if($amount === 1)
96
+         if ($amount === 1)
97 97
          {
98 98
              $this->variable = array_pop($vars);
99 99
              return;
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/If.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
     */
65 65
     public function getVariable() : ?Mailcode_Variables_Variable
66 66
     {
67
-        if(isset($this->variable))
67
+        if (isset($this->variable))
68 68
         {
69 69
             return $this->variable;
70 70
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $amount = $this->getVariables()->countVariables();
78 78
         
79
-        if($amount >= 1)
79
+        if ($amount >= 1)
80 80
         {
81 81
             return;
82 82
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $validations = array();
93 93
         
94
-        if($this->getType() === 'variable')
94
+        if ($this->getType() === 'variable')
95 95
         {
96 96
             $validations[] = 'require_variable';
97 97
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/For.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         $keyword = $info->getKeywordByIndex(1);
63 63
         $container = $info->getVariableByIndex(2);
64 64
         
65
-        if($variable && $keyword && $container && $keyword->isForIn())
65
+        if ($variable && $keyword && $container && $keyword->isForIn())
66 66
         {
67 67
             return;
68 68
         }
Please login to merge, or discard this patch.