@@ -173,6 +173,9 @@ discard block |
||
173 | 173 | $this->processInsertOperation( $operation, "diffmod" ); |
174 | 174 | } |
175 | 175 | |
176 | + /** |
|
177 | + * @param string $cssClass |
|
178 | + */ |
|
176 | 179 | protected function processInsertOperation($operation, $cssClass) |
177 | 180 | { |
178 | 181 | $text = array(); |
@@ -190,6 +193,9 @@ discard block |
||
190 | 193 | $this->insertTag( "ins", $cssClass, $text ); |
191 | 194 | } |
192 | 195 | |
196 | + /** |
|
197 | + * @param string $cssClass |
|
198 | + */ |
|
193 | 199 | protected function processDeleteOperation($operation, $cssClass) |
194 | 200 | { |
195 | 201 | $text = array(); |
@@ -231,6 +237,10 @@ discard block |
||
231 | 237 | return $this->diffElements($oldText, $newText, $stripWrappingTags); |
232 | 238 | } |
233 | 239 | |
240 | + /** |
|
241 | + * @param string $oldText |
|
242 | + * @param string $newText |
|
243 | + */ |
|
234 | 244 | protected function diffElements($oldText, $newText, $stripWrappingTags = true) |
235 | 245 | { |
236 | 246 | $wrapStart = ''; |
@@ -253,6 +263,10 @@ discard block |
||
253 | 263 | return $wrapStart . $diff->build() . $wrapEnd; |
254 | 264 | } |
255 | 265 | |
266 | + /** |
|
267 | + * @param string $oldText |
|
268 | + * @param string $newText |
|
269 | + */ |
|
256 | 270 | protected function diffList($oldText, $newText) |
257 | 271 | { |
258 | 272 | $diff = new ListDiffNew($oldText, $newText, $this->encoding, $this->specialCaseTags, $this->groupDiffs); |
@@ -261,6 +275,10 @@ discard block |
||
261 | 275 | return $diff->build(); |
262 | 276 | } |
263 | 277 | |
278 | + /** |
|
279 | + * @param string $oldText |
|
280 | + * @param string $newText |
|
281 | + */ |
|
264 | 282 | protected function diffTables($oldText, $newText) |
265 | 283 | { |
266 | 284 | $diff = new TableDiff($oldText, $newText, $this->encoding, $this->specialCaseTags, $this->groupDiffs); |
@@ -325,6 +343,9 @@ discard block |
||
325 | 343 | return null; |
326 | 344 | } |
327 | 345 | |
346 | + /** |
|
347 | + * @param string $text |
|
348 | + */ |
|
328 | 349 | protected function isListPlaceholder($text) |
329 | 350 | { |
330 | 351 | return $this->isPlaceholderType($text, array('ol', 'dl', 'ul')); |
@@ -365,6 +386,9 @@ discard block |
||
365 | 386 | return in_array($text, $criteria, $strict); |
366 | 387 | } |
367 | 388 | |
389 | + /** |
|
390 | + * @param string $text |
|
391 | + */ |
|
368 | 392 | protected function isTablePlaceholder($text) |
369 | 393 | { |
370 | 394 | return in_array($text, array( |
@@ -372,6 +396,10 @@ discard block |
||
372 | 396 | ), true); |
373 | 397 | } |
374 | 398 | |
399 | + /** |
|
400 | + * @param Operation $operation |
|
401 | + * @param integer $posInNew |
|
402 | + */ |
|
375 | 403 | protected function findIsolatedDiffTagsInOld($operation, $posInNew) |
376 | 404 | { |
377 | 405 | $offset = $posInNew - $operation->startInNew; |
@@ -379,6 +407,9 @@ discard block |
||
379 | 407 | return $this->oldIsolatedDiffTags[$operation->startInOld + $offset]; |
380 | 408 | } |
381 | 409 | |
410 | + /** |
|
411 | + * @param string $tag |
|
412 | + */ |
|
382 | 413 | protected function insertTag($tag, $cssClass, &$words) |
383 | 414 | { |
384 | 415 | while (true) { |
@@ -440,11 +471,17 @@ discard block |
||
440 | 471 | return $condition == 'tag' ? $this->isTag( $word ) : !$this->isTag( $word ); |
441 | 472 | } |
442 | 473 | |
474 | + /** |
|
475 | + * @param string $text |
|
476 | + */ |
|
443 | 477 | protected function wrapText($text, $tagName, $cssClass) |
444 | 478 | { |
445 | 479 | return sprintf( '<%1$s class="%2$s">%3$s</%1$s>', $tagName, $cssClass, $text ); |
446 | 480 | } |
447 | 481 | |
482 | + /** |
|
483 | + * @param string $condition |
|
484 | + */ |
|
448 | 485 | protected function extractConsecutiveWords(&$words, $condition) |
449 | 486 | { |
450 | 487 | $indexOfFirstTag = null; |
@@ -537,6 +574,12 @@ discard block |
||
537 | 574 | return $matchingBlocks; |
538 | 575 | } |
539 | 576 | |
577 | + /** |
|
578 | + * @param integer $startInOld |
|
579 | + * @param integer $endInOld |
|
580 | + * @param integer $startInNew |
|
581 | + * @param integer $endInNew |
|
582 | + */ |
|
540 | 583 | protected function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endInNew, &$matchingBlocks) |
541 | 584 | { |
542 | 585 | $match = $this->findMatch( $startInOld, $endInOld, $startInNew, $endInNew ); |
@@ -58,6 +58,9 @@ discard block |
||
58 | 58 | |
59 | 59 | protected $strategy = self::STRATEGY_MATCHING; |
60 | 60 | |
61 | + /** |
|
62 | + * @param string $encoding |
|
63 | + */ |
|
61 | 64 | public function __construct($oldText, $newText, $encoding, $specialCaseTags, $groupDiffs) |
62 | 65 | { |
63 | 66 | parent::__construct($oldText, $newText, $encoding, $specialCaseTags, $groupDiffs); |
@@ -278,6 +281,10 @@ discard block |
||
278 | 281 | } |
279 | 282 | } |
280 | 283 | |
284 | + /** |
|
285 | + * @param TableRow[] $oldRows |
|
286 | + * @param TableRow[] $newRows |
|
287 | + */ |
|
281 | 288 | protected function processEqualOperation($operation, $oldRows, $newRows, &$appliedRowSpans) |
282 | 289 | { |
283 | 290 | $targetOldRows = array_values(array_slice($oldRows, $operation->startInOld, $operation->endInOld - $operation->startInOld)); |
@@ -292,6 +299,10 @@ discard block |
||
292 | 299 | } |
293 | 300 | } |
294 | 301 | |
302 | + /** |
|
303 | + * @param TableRow[] $oldRows |
|
304 | + * @param TableRow[] $newRows |
|
305 | + */ |
|
295 | 306 | protected function processReplaceOperation($operation, $oldRows, $newRows, &$appliedRowSpans) |
296 | 307 | { |
297 | 308 | $this->processDeleteOperation($operation, $oldRows, $newRows, $appliedRowSpans, true); |
@@ -312,6 +323,12 @@ discard block |
||
312 | 323 | return $matches; |
313 | 324 | } |
314 | 325 | |
326 | + /** |
|
327 | + * @param integer $startInOld |
|
328 | + * @param integer $endInOld |
|
329 | + * @param integer $startInNew |
|
330 | + * @param integer $endInNew |
|
331 | + */ |
|
315 | 332 | protected function findRowMatches($newMatchData, $startInOld, $endInOld, $startInNew, $endInNew, &$matches) |
316 | 333 | { |
317 | 334 | $match = $this->findRowMatch($newMatchData, $startInOld, $endInOld, $startInNew, $endInNew); |
@@ -639,6 +656,9 @@ discard block |
||
639 | 656 | $this->newTable = $this->parseTableStructure(mb_convert_encoding($this->newText, 'HTML-ENTITIES', 'UTF-8')); |
640 | 657 | } |
641 | 658 | |
659 | + /** |
|
660 | + * @param string $text |
|
661 | + */ |
|
642 | 662 | protected function parseTableStructure($text) |
643 | 663 | { |
644 | 664 | $dom = new \DOMDocument(); |
@@ -704,6 +724,10 @@ discard block |
||
704 | 724 | return trim($domDocument->saveHTML()); |
705 | 725 | } |
706 | 726 | |
727 | + /** |
|
728 | + * @param \DOMElement $node |
|
729 | + * @param string $html |
|
730 | + */ |
|
707 | 731 | protected function setInnerHtml($node, $html) |
708 | 732 | { |
709 | 733 | // DOMDocument::loadHTML does not allow empty strings. |
@@ -738,7 +762,7 @@ discard block |
||
738 | 762 | } |
739 | 763 | |
740 | 764 | /** |
741 | - * @param $tableRow |
|
765 | + * @param TableRow|null $tableRow |
|
742 | 766 | * @param $currentColumn |
743 | 767 | * @param $targetColumn |
744 | 768 | * @param $currentCell |