Passed
Push — master ( 4d3781...3e400f )
by Sebastian
04:07
created
src/Mailcode/Parser/Safeguard.php 1 patch
Spacing   +20 added lines, -20 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',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $safe = str_replace(array_values($replaces), array_keys($replaces), $this->originalString);
172 172
 
173 173
         // If a formatter has been selected, let it modify the string.
174
-        if(isset($this->formatter))
174
+        if (isset($this->formatter))
175 175
         {
176 176
             $safe = $this->formatter->format($safe);
177 177
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $class = 'Mailcode\Mailcode_Parser_Safeguard_Formatter_'.$formatterID;
185 185
         
186
-        if(class_exists($class))
186
+        if (class_exists($class))
187 187
         {
188 188
             $this->formatter = new $class($this);
189 189
             
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $formatter = $this->selectFormatter('SingleLines');
211 211
         
212
-        if($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
212
+        if ($formatter instanceof Mailcode_Parser_Safeguard_Formatter_SingleLines)
213 213
         {
214 214
             return $formatter;
215 215
         }
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
     * @param bool $highlighted
232 232
     * @return string[]string
233 233
     */
234
-    protected function getReplaces(bool $highlighted=false) : array
234
+    protected function getReplaces(bool $highlighted = false) : array
235 235
     {
236 236
         $placeholders = $this->getPlaceholders();
237 237
         
238 238
         $replaces = array();
239 239
         
240
-        foreach($placeholders as $placeholder)
240
+        foreach ($placeholders as $placeholder)
241 241
         {
242 242
             $replace = '';
243 243
             
244
-            if($highlighted)
244
+            if ($highlighted)
245 245
             {
246 246
                 $replace = $placeholder->getHighlightedText();
247 247
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     */
266 266
     public function getPlaceholders()
267 267
     {
268
-        if(isset($this->placeholders))
268
+        if (isset($this->placeholders))
269 269
         {
270 270
             return $this->placeholders;
271 271
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         
275 275
         $cmds = $this->getCollection()->getGroupedByHash();
276 276
         
277
-        foreach($cmds as $command)
277
+        foreach ($cmds as $command)
278 278
         {
279 279
             self::$counter++;
280 280
             
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         return $this->placeholders;
289 289
     }
290 290
     
291
-    protected function restore(string $string, bool $partial=false, bool $highlighted=false) : string
291
+    protected function restore(string $string, bool $partial = false, bool $highlighted = false) : string
292 292
     {
293 293
         $this->requireValidCollection();
294 294
         
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
         
297 297
         $placeholderStrings = array_keys($replaces);
298 298
         
299
-        foreach($placeholderStrings as $search)
299
+        foreach ($placeholderStrings as $search)
300 300
         {
301
-            if(!$partial && !strstr($string, $search))
301
+            if (!$partial && !strstr($string, $search))
302 302
             {
303 303
                 throw new Mailcode_Exception(
304 304
                     'Command placeholder not found',
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     */
401 401
     public function getCollection() : Mailcode_Collection
402 402
     {
403
-        if(isset($this->collection))
403
+        if (isset($this->collection))
404 404
         {
405 405
             return $this->collection;
406 406
         }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     */
423 423
     protected function requireValidCollection() : void
424 424
     {
425
-        if($this->getCollection()->isValid())
425
+        if ($this->getCollection()->isValid())
426 426
         {
427 427
             return;
428 428
         }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     */
446 446
     public function getPlaceholderStrings() : array
447 447
     {
448
-        if(is_array($this->placeholderStrings))
448
+        if (is_array($this->placeholderStrings))
449 449
         {
450 450
             return $this->placeholderStrings;
451 451
         }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         
455 455
         $this->placeholderStrings = array();
456 456
         
457
-        foreach($placeholders as $placeholder)
457
+        foreach ($placeholders as $placeholder)
458 458
         {
459 459
             $this->placeholderStrings[] = $placeholder->getReplacementText();
460 460
         }
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
     {
481 481
         $placeholders = $this->getPlaceholders();
482 482
         
483
-        foreach($placeholders as $placeholder)
483
+        foreach ($placeholders as $placeholder)
484 484
         {
485
-            if($placeholder->getID() === $id)
485
+            if ($placeholder->getID() === $id)
486 486
             {
487 487
                 return $placeholder;
488 488
             }
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
     {
510 510
         $placeholders = $this->getPlaceholders();
511 511
         
512
-        foreach($placeholders as $placeholder)
512
+        foreach ($placeholders as $placeholder)
513 513
         {
514
-            if($placeholder->getReplacementText() === $string)
514
+            if ($placeholder->getReplacementText() === $string)
515 515
             {
516 516
                 return $placeholder;
517 517
             }
Please login to merge, or discard this patch.