Passed
Pull Request — master (#102)
by Sven
03:32
created
lib/Caxy/HtmlDiff/HtmlDiff.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
             } else {
546 546
                 $firstOrDefault = false;
547 547
                 foreach ($this->config->getSpecialCaseOpeningTags() as $x) {
548
-                    if (preg_match($x, $words[ 0 ])) {
548
+                    if (preg_match($x, $words[0])) {
549 549
                         $firstOrDefault = $x;
550 550
                         break;
551 551
                     }
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
                 if ($firstOrDefault) {
554 554
                     $specialCaseTagInjection = '<ins class="mod">';
555 555
                     if ($tag === 'del') {
556
-                        unset($words[ 0 ]);
556
+                        unset($words[0]);
557 557
                     }
558
-                } elseif (array_search($words[ 0 ], $this->config->getSpecialCaseClosingTags()) !== false) {
558
+                } elseif (array_search($words[0], $this->config->getSpecialCaseClosingTags()) !== false) {
559 559
                     $specialCaseTagInjection = '</ins>';
560 560
                     $specialCaseTagInjectionIsBefore = true;
561 561
                     if ($tag === 'del') {
562
-                        unset($words[ 0 ]);
562
+                        unset($words[0]);
563 563
                     }
564 564
                 }
565 565
             }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 break;
568 568
             }
569 569
             if ($specialCaseTagInjectionIsBefore) {
570
-                $this->content .= $specialCaseTagInjection . implode('', $this->extractConsecutiveWords($words, 'tag'));
570
+                $this->content .= $specialCaseTagInjection.implode('', $this->extractConsecutiveWords($words, 'tag'));
571 571
             } else {
572 572
                 $workTag = $this->extractConsecutiveWords($words, 'tag');
573 573
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
                     }
590 590
                 }
591 591
 
592
-                $appendContent = implode('', $workTag) . $specialCaseTagInjection;
592
+                $appendContent = implode('', $workTag).$specialCaseTagInjection;
593 593
 
594 594
                 if (isset($workTag[0]) === true && $this->stringUtil->stripos($workTag[0], '<img') !== false) {
595 595
                     $appendContent = $this->wrapText($appendContent, $tag, $cssClass);
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         $space = $this->stringUtil->strpos($word, ' ', 1);
766 766
 
767 767
         if ($space > 0) {
768
-            return '<' . $this->stringUtil->substr($word, 1, $space) . '>';
768
+            return '<'.$this->stringUtil->substr($word, 1, $space).'>';
769 769
         }
770 770
 
771 771
         return trim($word, '<>');
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         for ($indexInOld = $startInOld; $indexInOld < $endInOld; ++$indexInOld) {
783 783
             $newMatchLengthAt = [];
784 784
 
785
-            $index = $this->oldWords[ $indexInOld ];
785
+            $index = $this->oldWords[$indexInOld];
786 786
 
787 787
             if ($this->isTag($index) === true) {
788 788
                 $index = $this->stripTagAttributes($index);
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/AbstractDiff.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     }
404 404
 
405 405
     /**
406
-     * @param array $oldWords
406
+     * @param string[] $oldWords
407 407
      */
408 408
     protected function setOldWords(array $oldWords)
409 409
     {
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     }
413 413
 
414 414
     /**
415
-     * @param array $newWords
415
+     * @param string[] $newWords
416 416
      */
417 417
     protected function setNewWords(array $newWords)
418 418
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     public function initPurifier($defaultPurifierSerializerCache = null)
130 130
     {
131 131
         if (null !== $this->purifierConfig) {
132
-            $HTMLPurifierConfig  = $this->purifierConfig;
132
+            $HTMLPurifierConfig = $this->purifierConfig;
133 133
         } else {
134 134
             $HTMLPurifierConfig = HTMLPurifier_Config::createDefault();
135 135
         }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         $specialCharacters = '';
432 432
 
433 433
         foreach ($this->config->getSpecialCaseChars() as $char) {
434
-            $specialCharacters .= '\\' . $char;
434
+            $specialCharacters .= '\\'.$char;
435 435
         }
436 436
 
437 437
         // Normalize no-break-spaces to regular spaces
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
             // Split regex compiles to this (in default config case);
458 458
             // /\s|[\.\,\(\)\']|[a-zA-Z0-9\.\,\(\)\'\pL]+(?=[\.\,\(\)\'][\s\r\n])|[a-zA-Z0-9\.\,\(\)\'\pL]+|[^\s]/mu
459 459
             preg_match_all(
460
-                '/\s|' .                                                                               // Every space is considered a word
461
-                '['. $specialCharacters . ']|' .                                                       // Special characters that are not part of a word
462
-                '[a-zA-Z0-9' . $specialCharacters . '\pL]+(?=[' . $specialCharacters . '][\s\r\n])|' . // Words with special characters, excluding the last special character
463
-                '[a-zA-Z0-9' . $specialCharacters . '\pL]+|' .                                         // All other regular words
464
-                '[^\s]/mu',                                                                            // Catch all for everything else
465
-                $sentenceOrHtmlTag . ' ', // Inject a space at the end to make sure the second regex always hits.
460
+                '/\s|'.// Every space is considered a word
461
+                '['.$specialCharacters.']|'.// Special characters that are not part of a word
462
+                '[a-zA-Z0-9'.$specialCharacters.'\pL]+(?=['.$specialCharacters.'][\s\r\n])|'.// Words with special characters, excluding the last special character
463
+                '[a-zA-Z0-9'.$specialCharacters.'\pL]+|'.// All other regular words
464
+                '[^\s]/mu', // Catch all for everything else
465
+                $sentenceOrHtmlTag.' ', // Inject a space at the end to make sure the second regex always hits.
466 466
                 $sentenceSplitIntoWords,
467 467
                 PREG_SPLIT_NO_EMPTY
468 468
             );
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
         $lastCharacter  = $sentence[$this->stringUtil->strlen($sentence) - 1];
491 491
 
492 492
         if ($firstCharacter === ' ' || $firstCharacter === "\r" || $firstCharacter === "\n") {
493
-            $sentence = ' ' . ltrim($sentence);
493
+            $sentence = ' '.ltrim($sentence);
494 494
         }
495 495
 
496 496
         if ($lastCharacter === ' ' || $lastCharacter === "\r" || $lastCharacter === "\n") {
497
-            $sentence = rtrim($sentence) . ' ';
497
+            $sentence = rtrim($sentence).' ';
498 498
         }
499 499
 
500 500
         return $sentence;
Please login to merge, or discard this patch.