Passed
Pull Request — master (#102)
by Sven
02:57
created
lib/Caxy/HtmlDiff/Table/TableDiff.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 
230 230
     /**
231 231
      * @param Operation $operation
232
-     * @param array     $oldRows
233
-     * @param array     $newRows
232
+     * @param TableRow[]     $oldRows
233
+     * @param TableRow[]     $newRows
234 234
      * @param array     $appliedRowSpans
235 235
      */
236 236
     protected function processEqualOperation(Operation $operation, $oldRows, $newRows, &$appliedRowSpans)
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 
250 250
     /**
251 251
      * @param Operation $operation
252
-     * @param array     $oldRows
253
-     * @param array     $newRows
252
+     * @param TableRow[]     $oldRows
253
+     * @param TableRow[]     $newRows
254 254
      * @param array     $appliedRowSpans
255 255
      */
256 256
     protected function processReplaceOperation(Operation $operation, $oldRows, $newRows, &$appliedRowSpans)
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/HtmlDiffConfig.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     /**
96 96
      * @param int $matchThreshold
97 97
      *
98
-     * @return AbstractDiff
98
+     * @return HtmlDiffConfig
99 99
      */
100 100
     public function setMatchThreshold($matchThreshold)
101 101
     {
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/Preprocessor.php 1 patch
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -4,6 +4,11 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Preprocessor
6 6
 {
7
+    /**
8
+     * @param string $old
9
+     * @param string $new
10
+     * @param Util\MbStringUtil $stringUtil
11
+     */
7 12
     public static function diffCommonPrefix($old, $new, $stringUtil)
8 13
     {
9 14
         // Quick check for common null cases.
@@ -34,6 +39,11 @@  discard block
 block discarded – undo
34 39
         return $pointerMid;
35 40
     }
36 41
 
42
+    /**
43
+     * @param string $old
44
+     * @param string $new
45
+     * @param Util\MbStringUtil $stringUtil
46
+     */
37 47
     public static function diffCommonSuffix($old, $new, $stringUtil)
38 48
     {
39 49
         // Quick check for common null cases.
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/MatchingBlock.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
 
31 31
     public function count() : int
32 32
     {
33
-        return (int)$this->size;
33
+        return (int) $this->size;
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/LcsService.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
     }
28 28
 
29 29
     /**
30
-     * @param array $a
31
-     * @param array $b
30
+     * @param string[] $a
31
+     * @param string[] $b
32 32
      *
33 33
      * @return array
34 34
      */
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      * @param $c
71 71
      * @param $a
72 72
      * @param $b
73
-     * @param $i
74
-     * @param $j
73
+     * @param integer $i
74
+     * @param integer $j
75 75
      * @param $matches
76 76
      */
77 77
     protected function compileMatches($c, $a, $b, $i, $j, &$matches)
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/HtmlDiff.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -396,6 +396,12 @@
 block discarded – undo
396 396
         return $diff->build();
397 397
     }
398 398
 
399
+    /**
400
+     * @param string $oldText
401
+     * @param string $newText
402
+     * @param string $attribute
403
+     * @param string $element
404
+     */
399 405
     protected function diffElementsByAttribute($oldText, $newText, $attribute, $element)
400 406
     {
401 407
         $oldAttribute = $this->getAttributeFromTag($oldText, $attribute);
Please login to merge, or discard this 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/ListDiffLines.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     protected function findListNode(DOMDocument $dom) : DOMNode
100 100
     {
101
-        $xPathQuery = '//' . implode('|//', self::LIST_TAG_NAMES);
101
+        $xPathQuery = '//'.implode('|//', self::LIST_TAG_NAMES);
102 102
         $xPath      = new DOMXPath($dom);
103 103
         $listNodes  = $xPath->query($xPathQuery);
104 104
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     {
386 386
         $bufferDom = new DOMDocument('1.0', 'UTF-8');
387 387
 
388
-        foreach($node->childNodes as $childNode)
388
+        foreach ($node->childNodes as $childNode)
389 389
         {
390 390
             $bufferDom->appendChild($bufferDom->importNode($childNode, true));
391 391
         }
Please login to merge, or discard this patch.
lib/Caxy/HtmlDiff/AbstractDiff.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -421,8 +421,8 @@
 block discarded – undo
421 421
     }
422 422
 
423 423
     /**
424
-     * @param array $characterString
425 424
      *
425
+     * @param string $text
426 426
      * @return array
427 427
      */
428 428
     protected function convertHtmlToListOfWords($text)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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
         }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $specialCharacters = '';
434 434
 
435 435
         foreach ($this->config->getSpecialCaseChars() as $char) {
436
-            $specialCharacters .= '\\' . $char;
436
+            $specialCharacters .= '\\'.$char;
437 437
         }
438 438
 
439 439
         // Normalize no-break-spaces to regular spaces
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
             $lastCharacter  = $sentenceOrHtmlTag[$this->stringUtil->strlen($sentenceOrHtmlTag) - 1];
460 460
 
461 461
             if ($firstCharacter === ' ' || $firstCharacter === "\r" || $firstCharacter === "\n") {
462
-                $sentenceOrHtmlTag = ' ' . ltrim($sentenceOrHtmlTag);
462
+                $sentenceOrHtmlTag = ' '.ltrim($sentenceOrHtmlTag);
463 463
             }
464 464
 
465 465
             if ($lastCharacter === ' ' || $lastCharacter === "\r" || $lastCharacter === "\n") {
466
-                $sentenceOrHtmlTag = rtrim($sentenceOrHtmlTag) . ' ';
466
+                $sentenceOrHtmlTag = rtrim($sentenceOrHtmlTag).' ';
467 467
             }
468 468
 
469 469
             $sentenceSplitIntoWords = [];
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
             // Third group is alpha numeric words including special characters
478 478
             // Fourth group is a catch all of everything else.
479 479
             preg_match_all(
480
-                '/\s|[a-zA-Z0-9' . $specialCharacters . '\pL]+(?=[' . $specialCharacters . '][\s\r\n])|[a-zA-Z0-9' . $specialCharacters . '\pL]+|[^\s]/mu',
481
-                $sentenceOrHtmlTag . ' ', // Inject a space at the end to make sure the second regex always hits.
480
+                '/\s|[a-zA-Z0-9'.$specialCharacters.'\pL]+(?=['.$specialCharacters.'][\s\r\n])|[a-zA-Z0-9'.$specialCharacters.'\pL]+|[^\s]/mu',
481
+                $sentenceOrHtmlTag.' ', // Inject a space at the end to make sure the second regex always hits.
482 482
                 $sentenceSplitIntoWords,
483 483
                 PREG_SPLIT_NO_EMPTY
484 484
             );
Please login to merge, or discard this patch.