Passed
Push — master ( 430c98...5aa9a6 )
by Sebastian
02:51
created
src/Mailcode/Parser/Safeguard.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     */
135 135
     public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard
136 136
     {
137
-        if(empty($delimiter))
137
+        if (empty($delimiter))
138 138
         {
139 139
             throw new Mailcode_Exception(
140 140
                 'Empty delimiter',
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $safe = str_replace(array_values($replaces), array_keys($replaces), $this->originalString);
187 187
 
188 188
         // If a formatter has been selected, let it modify the string.
189
-        if(isset($this->formatter))
189
+        if (isset($this->formatter))
190 190
         {
191 191
             $safe = $this->formatter->format($safe);
192 192
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     {
199 199
         $class = 'Mailcode\Mailcode_Parser_Safeguard_Formatter_'.$formatterID;
200 200
         
201
-        if(class_exists($class))
201
+        if (class_exists($class))
202 202
         {
203 203
             $this->formatter = new $class($this);
204 204
             
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $formatter = $this->selectFormatter('HTMLHighlighting');
222 222
         
223
-        if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting)
223
+        if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_HTMLHighlighting)
224 224
         {
225 225
             return $formatter;
226 226
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         $formatter = $this->selectFormatter('SingleLines');
238 238
         
239
-        if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
239
+        if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
240 240
         {
241 241
             return $formatter;
242 242
         }
@@ -263,22 +263,22 @@  discard block
 block discarded – undo
263 263
     * @param bool $highlighted
264 264
     * @return string[]string
265 265
     */
266
-    protected function getReplaces(bool $highlighted=false, bool $normalize=false) : array
266
+    protected function getReplaces(bool $highlighted = false, bool $normalize = false) : array
267 267
     {
268 268
         $placeholders = $this->getPlaceholders();
269 269
         
270 270
         $replaces = array();
271 271
         
272
-        foreach($placeholders as $placeholder)
272
+        foreach ($placeholders as $placeholder)
273 273
         {
274 274
             $replace = '';
275 275
             $needle = $placeholder->getReplacementText();
276 276
             
277
-            if($highlighted)
277
+            if ($highlighted)
278 278
             {
279 279
                 $formattedNeedle = $this->formatter->getReplaceNeedle($placeholder);
280 280
                 
281
-                if($formattedNeedle !== $needle)
281
+                if ($formattedNeedle !== $needle)
282 282
                 {
283 283
                     $replaces[$formattedNeedle] = $placeholder->getHighlightedText();
284 284
                     $replace = $placeholder->getNormalizedText();
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                     $replace = $placeholder->getHighlightedText();
289 289
                 }
290 290
             }
291
-            else if($normalize)
291
+            else if ($normalize)
292 292
             {
293 293
                 $replace = $placeholder->getNormalizedText();
294 294
             }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     
306 306
     protected function getReplaceNeedle(Mailcode_Parser_Safeguard_Placeholder $placeholder) : string
307 307
     {
308
-        if(isset($this->formatter))
308
+        if (isset($this->formatter))
309 309
         {
310 310
             return $this->formatter->getReplaceNeedle($placeholder);
311 311
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     */
322 322
     public function getPlaceholders()
323 323
     {
324
-        if(isset($this->placeholders))
324
+        if (isset($this->placeholders))
325 325
         {
326 326
             return $this->placeholders;
327 327
         }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         
331 331
         $cmds = $this->getCollection()->getGroupedByHash();
332 332
         
333
-        foreach($cmds as $command)
333
+        foreach ($cmds as $command)
334 334
         {
335 335
             self::$counter++;
336 336
             
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
         return $this->placeholders;
345 345
     }
346 346
     
347
-    protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string
347
+    protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string
348 348
     {
349
-        if(!$partial)
349
+        if (!$partial)
350 350
         {
351 351
             $this->requireValidCollection();
352 352
         }
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
         
356 356
         $placeholderStrings = array_keys($replaces);
357 357
         
358
-        foreach($placeholderStrings as $search)
358
+        foreach ($placeholderStrings as $search)
359 359
         {
360
-            if(!$partial && !$highlighted && !strstr($string, $search))
360
+            if (!$partial && !$highlighted && !strstr($string, $search))
361 361
             {
362 362
                 throw new Mailcode_Exception(
363 363
                     'Command placeholder not found',
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
     */
460 460
     public function getCollection() : Mailcode_Collection
461 461
     {
462
-        if(isset($this->collection))
462
+        if (isset($this->collection))
463 463
         {
464 464
             return $this->collection;
465 465
         }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     */
482 482
     protected function requireValidCollection() : void
483 483
     {
484
-        if($this->getCollection()->isValid())
484
+        if ($this->getCollection()->isValid())
485 485
         {
486 486
             return;
487 487
         }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     */
505 505
     public function getPlaceholderStrings() : array
506 506
     {
507
-        if(is_array($this->placeholderStrings))
507
+        if (is_array($this->placeholderStrings))
508 508
         {
509 509
             return $this->placeholderStrings;
510 510
         }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         
514 514
         $this->placeholderStrings = array();
515 515
         
516
-        foreach($placeholders as $placeholder)
516
+        foreach ($placeholders as $placeholder)
517 517
         {
518 518
             $this->placeholderStrings[] = $placeholder->getReplacementText();
519 519
         }
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
     {
540 540
         $placeholders = $this->getPlaceholders();
541 541
         
542
-        foreach($placeholders as $placeholder)
542
+        foreach ($placeholders as $placeholder)
543 543
         {
544
-            if($placeholder->getID() === $id)
544
+            if ($placeholder->getID() === $id)
545 545
             {
546 546
                 return $placeholder;
547 547
             }
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
     {
569 569
         $placeholders = $this->getPlaceholders();
570 570
         
571
-        foreach($placeholders as $placeholder)
571
+        foreach ($placeholders as $placeholder)
572 572
         {
573
-            if($placeholder->getReplacementText() === $string)
573
+            if ($placeholder->getReplacementText() === $string)
574 574
             {
575 575
                 return $placeholder;
576 576
             }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Misc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     
35 35
         $this->instantiator->checkCommand($cmd);
36 36
         
37
-        if($cmd instanceof Mailcode_Commands_Command_Comment)
37
+        if ($cmd instanceof Mailcode_Commands_Command_Comment)
38 38
         {
39 39
             return $cmd;
40 40
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         throw $this->instantiator->exceptionUnexpectedType('Comment', $cmd);
43 43
     }
44 44
     
45
-    public function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
45
+    public function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
46 46
     {
47 47
         $sourceVariable = '$'.ltrim($sourceVariable, '$');
48 48
         $loopVariable = '$'.ltrim($loopVariable, '$');
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         
65 65
         $this->instantiator->checkCommand($cmd);
66 66
         
67
-        if($cmd instanceof Mailcode_Commands_Command_For)
67
+        if ($cmd instanceof Mailcode_Commands_Command_For)
68 68
         {
69 69
             return $cmd;
70 70
         }
Please login to merge, or discard this patch.
src/Mailcode/Commands/Command/For.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     
89 89
     public function getSourceVariable() : Mailcode_Variables_Variable
90 90
     {
91
-        if(isset($this->sourceVar))
91
+        if (isset($this->sourceVar))
92 92
         {
93 93
             return $this->sourceVar->getVariable();
94 94
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     
103 103
     public function getLoopVariable() : Mailcode_Variables_Variable
104 104
     {
105
-        if(isset($this->loopVar))
105
+        if (isset($this->loopVar))
106 106
         {
107 107
             return $this->loopVar->getVariable();
108 108
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $this->keyword = $info->getKeywordByIndex(1);
123 123
         $this->sourceVar = $info->getVariableByIndex(2);
124 124
         
125
-        if(!$this->loopVar || !$this->keyword || !$this->sourceVar)
125
+        if (!$this->loopVar || !$this->keyword || !$this->sourceVar)
126 126
         {
127 127
             $this->validationResult->makeError(
128 128
                 t('Not a valid for loop.').' '.t('Is the %1$s keyword missing?', 'in:'),
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     
136 136
     protected function validateSyntax_keyword() : void
137 137
     {
138
-        if($this->keyword->isForIn())
138
+        if ($this->keyword->isForIn())
139 139
         {
140 140
             return;
141 141
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     
149 149
     protected function validateSyntax_variable_names() : void
150 150
     {
151
-        if($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName())
151
+        if ($this->sourceVar->getVariable()->getFullName() !== $this->loopVar->getVariable()->getFullName())
152 152
         {
153 153
             return;
154 154
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param string $formatString A date format string, or empty string for default.
48 48
      * @return Mailcode_Commands_Command_ShowDate
49 49
      */
50
-    public static function showDate(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate
50
+    public static function showDate(string $variableName, string $formatString = "") : Mailcode_Commands_Command_ShowDate
51 51
     {
52 52
         return self::$commandSets->show()->showDate($variableName, $formatString);
53 53
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     * 
75 75
     * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED
76 76
     */
77
-    public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable
77
+    public static function setVar(string $variableName, string $value, bool $quoteValue = true) : Mailcode_Commands_Command_SetVariable
78 78
     {
79 79
         return self::$commandSets->set()->setVar($variableName, $value, $quoteValue);
80 80
     }
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
         return self::$commandSets->if()->end();
108 108
     }
109 109
     
110
-    public static function if(string $condition, string $type='') : Mailcode_Commands_Command_If
110
+    public static function if (string $condition, string $type = '') : Mailcode_Commands_Command_If
111 111
     {
112 112
         return self::$commandSets->if()->if($condition, $type);
113 113
     }
114 114
     
115
-    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
115
+    public static function ifVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
116 116
     {
117 117
         return self::$commandSets->if()->ifVar($variable, $operand, $value, $quoteValue);
118 118
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         return self::$commandSets->if()->ifVarString($variable, $operand, $value);
123 123
     }
124 124
     
125
-    public static function ifVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
125
+    public static function ifVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
126 126
     {
127 127
         return self::$commandSets->if()->ifVarEquals($variable, $value, $quoteValue);
128 128
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         return self::$commandSets->if()->ifVarEqualsString($variable, $value);
133 133
     }
134 134
     
135
-    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_If_Variable
135
+    public static function ifVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_If_Variable
136 136
     {
137 137
         return self::$commandSets->if()->ifVarNotEquals($variable, $value, $quoteValue);
138 138
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         return self::$commandSets->if()->ifVarNotEqualsString($variable, $value);
143 143
     }
144 144
     
145
-    public static function elseIf(string $condition, string $type='') : Mailcode_Commands_Command_ElseIf
145
+    public static function elseIf (string $condition, string $type = '') : Mailcode_Commands_Command_ElseIf
146 146
     {
147 147
         return self::$commandSets->elseIf()->elseIf($condition, $type);
148 148
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         return self::$commandSets->elseIf()->elseIfNotEmpty($variable);
158 158
     }
159 159
     
160
-    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
160
+    public static function elseIfVar(string $variable, string $operand, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
161 161
     {
162 162
         return self::$commandSets->elseIf()->elseIfVar($variable, $operand, $value, $quoteValue);
163 163
     }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         return self::$commandSets->elseIf()->elseIfVarString($variable, $operand, $value);
168 168
     }
169 169
     
170
-    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
170
+    public static function elseIfVarEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
171 171
     {
172 172
         return self::$commandSets->elseIf()->elseIfVarEquals($variable, $value, $quoteValue);
173 173
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         return self::$commandSets->elseIf()->elseIfVarEqualsString($variable, $value);
178 178
     }
179 179
     
180
-    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue=false) : Mailcode_Commands_Command_ElseIf_Variable
180
+    public static function elseIfVarNotEquals(string $variable, string $value, bool $quoteValue = false) : Mailcode_Commands_Command_ElseIf_Variable
181 181
     {
182 182
         return self::$commandSets->elseIf()->elseIfVarNotEquals($variable, $value, $quoteValue);
183 183
     }
@@ -187,27 +187,27 @@  discard block
 block discarded – undo
187 187
         return self::$commandSets->elseIf()->elseIfVarNotEqualsString($variable, $value);
188 188
     }
189 189
 
190
-    public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_BeginsWith
190
+    public static function ifBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_BeginsWith
191 191
     {
192 192
         return self::$commandSets->if()->ifBeginsWith($variable, $search, $caseInsensitive);
193 193
     }
194 194
 
195
-    public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_EndsWith
195
+    public static function ifEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_EndsWith
196 196
     {
197 197
         return self::$commandSets->if()->ifEndsWith($variable, $search, $caseInsensitive);
198 198
     }
199 199
 
200
-    public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_BeginsWith
200
+    public static function elseIfBeginsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_BeginsWith
201 201
     {
202 202
         return self::$commandSets->elseIf()->elseIfBeginsWith($variable, $search, $caseInsensitive);
203 203
     }
204 204
     
205
-    public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_EndsWith
205
+    public static function elseIfEndsWith(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_EndsWith
206 206
     {
207 207
         return self::$commandSets->elseIf()->elseIfEndsWith($variable, $search, $caseInsensitive);
208 208
     }
209 209
     
210
-    public static function ifContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains
210
+    public static function ifContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains
211 211
     {
212 212
         return self::$commandSets->if()->ifContains($variable, array($search), $caseInsensitive);
213 213
     }
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
     * @param bool $caseInsensitive
221 221
     * @return Mailcode_Commands_Command_If_Contains
222 222
     */
223
-    public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains
223
+    public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_If_Contains
224 224
     {
225 225
         return self::$commandSets->if()->ifContains($variable, $searchTerms, $caseInsensitive);
226 226
     }
227 227
     
228
-    public static function elseIfContains(string $variable, string $search, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains
228
+    public static function elseIfContains(string $variable, string $search, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains
229 229
     {
230 230
         return self::$commandSets->elseIf()->elseIfContains($variable, array($search), $caseInsensitive);
231 231
     }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     * @param bool $caseInsensitive
239 239
     * @return Mailcode_Commands_Command_ElseIf_Contains
240 240
     */
241
-    public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains
241
+    public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive = false) : Mailcode_Commands_Command_ElseIf_Contains
242 242
     {
243 243
         return self::$commandSets->elseIf()->elseIfContains($variable, $searchTerms, $caseInsensitive);
244 244
     }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         return self::$commandSets->if()->ifNotEmpty($variable);
254 254
     }
255 255
     
256
-    public static function for(string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
256
+    public static function for (string $sourceVariable, string $loopVariable) : Mailcode_Commands_Command_For
257 257
     {
258 258
         return self::$commandSets->misc()->for($sourceVariable, $loopVariable);
259 259
     }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     
294 294
     public static function init() : void
295 295
     {
296
-        if(!isset(self::$commandSets))
296
+        if (!isset(self::$commandSets))
297 297
         {
298 298
             self::$commandSets = new Mailcode_Factory_CommandSets();
299 299
         }
Please login to merge, or discard this patch.