@@ -229,8 +229,8 @@ discard block |
||
| 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 |
||
| 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) |
@@ -95,7 +95,7 @@ |
||
| 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 | { |
@@ -527,7 +527,9 @@ |
||
| 527 | 527 | $mode = 'tag'; |
| 528 | 528 | } elseif (preg_match("/\s/u", $character)) { |
| 529 | 529 | $current_word .= $character; |
| 530 | - if (!$keepNewLines) $current_word = preg_replace('/\s+/Su', ' ', $current_word); |
|
| 530 | + if (!$keepNewLines) { |
|
| 531 | + $current_word = preg_replace('/\s+/Su', ' ', $current_word); |
|
| 532 | + } |
|
| 531 | 533 | } else { |
| 532 | 534 | if ($current_word != '') { |
| 533 | 535 | $words[] = $current_word; |
@@ -129,7 +129,7 @@ |
||
| 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 | } |
@@ -4,6 +4,11 @@ discard block |
||
| 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 |
||
| 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. |
@@ -30,6 +30,6 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function count() : int |
| 32 | 32 | { |
| 33 | - return (int)$this->size; |
|
| 33 | + return (int) $this->size; |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 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 |
||
| 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) |
@@ -396,6 +396,12 @@ |
||
| 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); |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | if ($this->isTag($word)) { |
| 131 | 131 | $word = $this->stripTagAttributes($word); |
| 132 | 132 | } |
| 133 | - if (isset($this->wordIndices[ $word ])) { |
|
| 134 | - $this->wordIndices[ $word ][] = $i; |
|
| 133 | + if (isset($this->wordIndices[$word])) { |
|
| 134 | + $this->wordIndices[$word][] = $i; |
|
| 135 | 135 | } else { |
| 136 | - $this->wordIndices[ $word ] = array($i); |
|
| 136 | + $this->wordIndices[$word] = array($i); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | } else { |
| 550 | 550 | $firstOrDefault = false; |
| 551 | 551 | foreach ($this->config->getSpecialCaseOpeningTags() as $x) { |
| 552 | - if (preg_match($x, $words[ 0 ])) { |
|
| 552 | + if (preg_match($x, $words[0])) { |
|
| 553 | 553 | $firstOrDefault = $x; |
| 554 | 554 | break; |
| 555 | 555 | } |
@@ -557,13 +557,13 @@ discard block |
||
| 557 | 557 | if ($firstOrDefault) { |
| 558 | 558 | $specialCaseTagInjection = '<ins class="mod">'; |
| 559 | 559 | if ($tag === 'del') { |
| 560 | - unset($words[ 0 ]); |
|
| 560 | + unset($words[0]); |
|
| 561 | 561 | } |
| 562 | - } elseif (array_search($words[ 0 ], $this->config->getSpecialCaseClosingTags()) !== false) { |
|
| 562 | + } elseif (array_search($words[0], $this->config->getSpecialCaseClosingTags()) !== false) { |
|
| 563 | 563 | $specialCaseTagInjection = '</ins>'; |
| 564 | 564 | $specialCaseTagInjectionIsBefore = true; |
| 565 | 565 | if ($tag === 'del') { |
| 566 | - unset($words[ 0 ]); |
|
| 566 | + unset($words[0]); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | break; |
| 572 | 572 | } |
| 573 | 573 | if ($specialCaseTagInjectionIsBefore) { |
| 574 | - $this->content .= $specialCaseTagInjection . implode('', $this->extractConsecutiveWords($words, 'tag')); |
|
| 574 | + $this->content .= $specialCaseTagInjection.implode('', $this->extractConsecutiveWords($words, 'tag')); |
|
| 575 | 575 | } else { |
| 576 | 576 | $workTag = $this->extractConsecutiveWords($words, 'tag'); |
| 577 | 577 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - $appendContent = implode('', $workTag) . $specialCaseTagInjection; |
|
| 596 | + $appendContent = implode('', $workTag).$specialCaseTagInjection; |
|
| 597 | 597 | |
| 598 | 598 | if (isset($workTag[0]) === true && $this->stringUtil->stripos($workTag[0], '<img') !== false) { |
| 599 | 599 | $appendContent = $this->wrapText($appendContent, $tag, $cssClass); |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $space = $this->stringUtil->strpos($word, ' ', 1); |
| 775 | 775 | |
| 776 | 776 | if ($space) { |
| 777 | - return '<' . $this->stringUtil->substr($word, 1, $space) . '>'; |
|
| 777 | + return '<'.$this->stringUtil->substr($word, 1, $space).'>'; |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | return trim($word, '<>'); |
@@ -798,15 +798,15 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | for ($indexInOld = $startInOld; $indexInOld < $endInOld; ++$indexInOld) { |
| 800 | 800 | $newMatchLengthAt = array(); |
| 801 | - $index = $this->oldWords[ $indexInOld ]; |
|
| 801 | + $index = $this->oldWords[$indexInOld]; |
|
| 802 | 802 | if ($this->isTag($index)) { |
| 803 | 803 | $index = $this->stripTagAttributes($index); |
| 804 | 804 | } |
| 805 | - if (!isset($this->wordIndices[ $index ])) { |
|
| 805 | + if (!isset($this->wordIndices[$index])) { |
|
| 806 | 806 | $matchLengthAt = $newMatchLengthAt; |
| 807 | 807 | continue; |
| 808 | 808 | } |
| 809 | - foreach ($this->wordIndices[ $index ] as $indexInNew) { |
|
| 809 | + foreach ($this->wordIndices[$index] as $indexInNew) { |
|
| 810 | 810 | if ($indexInNew < $startInNew) { |
| 811 | 811 | continue; |
| 812 | 812 | } |
@@ -814,8 +814,8 @@ discard block |
||
| 814 | 814 | break; |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - $newMatchLength = (isset($matchLengthAt[ $indexInNew - 1 ]) ? $matchLengthAt[ $indexInNew - 1 ] : 0) + 1; |
|
| 818 | - $newMatchLengthAt[ $indexInNew ] = $newMatchLength; |
|
| 817 | + $newMatchLength = (isset($matchLengthAt[$indexInNew - 1]) ? $matchLengthAt[$indexInNew - 1] : 0) + 1; |
|
| 818 | + $newMatchLengthAt[$indexInNew] = $newMatchLength; |
|
| 819 | 819 | |
| 820 | 820 | if ($newMatchLength > $bestMatchSize || |
| 821 | 821 | ( |
@@ -98,7 +98,7 @@ discard block |
||
| 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 |
||
| 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 | } |