Passed
Pull Request — master (#5)
by
unknown
03:44
created
src/EntityDecoder.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     $entitytext .= $stopChar;
208 208
                     array_pop($openedEntities);
209 209
                     array_pop($openedEntities);
210
-                    if(empty($openedEntities))
210
+                    if (empty($openedEntities))
211 211
                     {
212 212
                         $entitiesArray[] = $entitytext;
213 213
                         $entitytext = "";
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     $stopChar = $this->getEntityStopString($stEntity);
219 219
                     $entitytext .= $stopChar;
220 220
                     array_pop($openedEntities);
221
-                    if(empty($openedEntities))
221
+                    if (empty($openedEntities))
222 222
                     {
223 223
                         $entitiesArray[] = $entitytext;
224 224
                         $entitytext = "";
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             if ($entityCheckStart === false && $entityCheckStop === false)
229 229
             {
230 230
                 $isEntityOpen = !empty($openedEntities);
231
-                if($isEntityOpen)
231
+                if ($isEntityOpen)
232 232
                 {
233 233
                     $entitytext .= $this->escapeSpecialChars($arrayText[$i]['char'], $isEntityOpen, $openedEntities);
234 234
                 }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             }
364 364
 
365 365
             if ($isPreOpen) {
366
-                return (in_array($char, ['`', '\\']) ? '\\' . $char : $char);
366
+                return (in_array($char, ['`', '\\']) ? '\\'.$char : $char);
367 367
             }
368 368
 
369 369
             return (in_array($char, ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!', '\\']) ? '\\'.$char : $char);
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
         if (in_array($style, ["HTML", "MarkdownV2", "Markdown"]))
34 34
         {
35 35
             $this->style = $style;
36
-        }
37
-        else
36
+        } else
38 37
         {
39 38
             throw new \InvalidArgumentException("Wrong style name");
40 39
         }
@@ -268,24 +267,21 @@  discard block
 block discarded – undo
268 267
             {
269 268
                 //Manage the modifiers
270 269
                 $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend the modifier to the previous char
271
-            }
272
-            else
270
+            } else
273 271
             {
274 272
                 if ($codepoint == "200d")
275 273
                 {
276 274
                     //Manage the Zero Width Joiner
277 275
                     $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend the ZWJ to the previous char
278 276
                     $joiner = true;
279
-                }
280
-                else
277
+                } else
281 278
                 {
282 279
                     if ($joiner)
283 280
                     {
284 281
                         //If previous one was a ZWJ
285 282
                         $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend to the previous char
286 283
                         $joiner = false;
287
-                    }
288
-                    else
284
+                    } else
289 285
                     {
290 286
                         $new_string_split[] = $str_split_unicode[$i]; //New char
291 287
                     }
@@ -314,34 +310,28 @@  discard block
 block discarded – undo
314 310
                     if ($char == $this->getEntityStartString($entity))
315 311
                     {
316 312
                         return $char."\\".$char.$char;
317
-                    }
318
-                    else
313
+                    } else
319 314
                     {
320 315
                         return $char;
321 316
                     }
322
-                }
323
-                else
317
+                } else
324 318
                 {
325 319
                     return $char;
326 320
                 }
327
-            }
328
-            else
321
+            } else
329 322
             {
330 323
                 if ($char == '*' || $char == '_' || $char == '[' || $char == '`')
331 324
                 {
332 325
                     return "\\".$char;
333
-                }
334
-                else
326
+                } else
335 327
                 {
336 328
                     return $char;
337 329
                 }
338 330
             }
339
-        }
340
-        else if ($this->style === 'HTML')
331
+        } else if ($this->style === 'HTML')
341 332
         {
342 333
             return ($char == '<' ? '&lt;' : ($char == '>' ? '&gt;' : ($char == '&' ? '&amp;' : $char)));
343
-        }
344
-        else if ($this->style === 'MarkdownV2')
334
+        } else if ($this->style === 'MarkdownV2')
345 335
         {
346 336
             $isBlockquoteOpen = false;
347 337
             $isPreOpen = false;
@@ -367,8 +357,7 @@  discard block
 block discarded – undo
367 357
             }
368 358
 
369 359
             return (in_array($char, ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!', '\\']) ? '\\'.$char : $char);
370
-        }
371
-        else
360
+        } else
372 361
         {
373 362
             return $char;
374 363
         }
@@ -416,8 +405,7 @@  discard block
 block discarded – undo
416 405
                     break;
417 406
                 }
418 407
             }
419
-        }
420
-        else if ($this->style == 'HTML')
408
+        } else if ($this->style == 'HTML')
421 409
         {
422 410
             switch ($entity->type)
423 411
             {
@@ -481,8 +469,7 @@  discard block
 block discarded – undo
481 469
                     break;
482 470
                 }
483 471
             }
484
-        }
485
-        else if ($this->style == 'MarkdownV2')
472
+        } else if ($this->style == 'MarkdownV2')
486 473
         {
487 474
             switch ($entity->type)
488 475
             {
@@ -611,8 +598,7 @@  discard block
 block discarded – undo
611 598
                     break;
612 599
                 }
613 600
             }
614
-        }
615
-        else if ($this->style == 'HTML')
601
+        } else if ($this->style == 'HTML')
616 602
         {
617 603
             switch ($entity->type)
618 604
             {
@@ -672,8 +658,7 @@  discard block
 block discarded – undo
672 658
                     break;
673 659
                 }
674 660
             }
675
-        }
676
-        else if ($this->style == 'MarkdownV2')
661
+        } else if ($this->style == 'MarkdownV2')
677 662
         {
678 663
             switch ($entity->type)
679 664
             {
Please login to merge, or discard this patch.