Passed
Push — master ( c5c69e...a80c4b )
by Sebastian
02:54
created
src/Mailcode/Parser/Safeguard.php 1 patch
Spacing   +21 added lines, -21 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
             
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         $formatter = $this->selectFormatter('SingleLines');
226 226
         
227
-        if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
227
+        if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
228 228
         {
229 229
             return $formatter;
230 230
         }
@@ -246,17 +246,17 @@  discard block
 block discarded – undo
246 246
     * @param bool $highlighted
247 247
     * @return string[]string
248 248
     */
249
-    protected function getReplaces(bool $highlighted=false) : array
249
+    protected function getReplaces(bool $highlighted = false) : array
250 250
     {
251 251
         $placeholders = $this->getPlaceholders();
252 252
         
253 253
         $replaces = array();
254 254
         
255
-        foreach($placeholders as $placeholder)
255
+        foreach ($placeholders as $placeholder)
256 256
         {
257 257
             $replace = '';
258 258
             
259
-            if($highlighted)
259
+            if ($highlighted)
260 260
             {
261 261
                 $replace = $placeholder->getHighlightedText();
262 262
             }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     */
281 281
     public function getPlaceholders()
282 282
     {
283
-        if(isset($this->placeholders))
283
+        if (isset($this->placeholders))
284 284
         {
285 285
             return $this->placeholders;
286 286
         }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         
290 290
         $cmds = $this->getCollection()->getGroupedByHash();
291 291
         
292
-        foreach($cmds as $command)
292
+        foreach ($cmds as $command)
293 293
         {
294 294
             self::$counter++;
295 295
             
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
         return $this->placeholders;
304 304
     }
305 305
     
306
-    protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string
306
+    protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string
307 307
     {
308
-        if(!$partial)
308
+        if (!$partial)
309 309
         {
310 310
             $this->requireValidCollection();
311 311
         }
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
         
315 315
         $placeholderStrings = array_keys($replaces);
316 316
         
317
-        foreach($placeholderStrings as $search)
317
+        foreach ($placeholderStrings as $search)
318 318
         {
319
-            if(!$partial && !strstr($string, $search))
319
+            if (!$partial && !strstr($string, $search))
320 320
             {
321 321
                 throw new Mailcode_Exception(
322 322
                     'Command placeholder not found',
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     */
419 419
     public function getCollection() : Mailcode_Collection
420 420
     {
421
-        if(isset($this->collection))
421
+        if (isset($this->collection))
422 422
         {
423 423
             return $this->collection;
424 424
         }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     */
441 441
     protected function requireValidCollection() : void
442 442
     {
443
-        if($this->getCollection()->isValid())
443
+        if ($this->getCollection()->isValid())
444 444
         {
445 445
             return;
446 446
         }
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
     */
464 464
     public function getPlaceholderStrings() : array
465 465
     {
466
-        if(is_array($this->placeholderStrings))
466
+        if (is_array($this->placeholderStrings))
467 467
         {
468 468
             return $this->placeholderStrings;
469 469
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         
473 473
         $this->placeholderStrings = array();
474 474
         
475
-        foreach($placeholders as $placeholder)
475
+        foreach ($placeholders as $placeholder)
476 476
         {
477 477
             $this->placeholderStrings[] = $placeholder->getReplacementText();
478 478
         }
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
     {
499 499
         $placeholders = $this->getPlaceholders();
500 500
         
501
-        foreach($placeholders as $placeholder)
501
+        foreach ($placeholders as $placeholder)
502 502
         {
503
-            if($placeholder->getID() === $id)
503
+            if ($placeholder->getID() === $id)
504 504
             {
505 505
                 return $placeholder;
506 506
             }
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
     {
528 528
         $placeholders = $this->getPlaceholders();
529 529
         
530
-        foreach($placeholders as $placeholder)
530
+        foreach ($placeholders as $placeholder)
531 531
         {
532
-            if($placeholder->getReplacementText() === $string)
532
+            if ($placeholder->getReplacementText() === $string)
533 533
             {
534 534
                 return $placeholder;
535 535
             }
Please login to merge, or discard this patch.