@@ -147,6 +147,10 @@ discard block |
||
| 147 | 147 | return "</".$tag.">"; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | + /** |
|
| 151 | + * @param string $str |
|
| 152 | + * @param string $start |
|
| 153 | + */ |
|
| 150 | 154 | protected function getStringBetween($str, $start, $end) |
| 151 | 155 | { |
| 152 | 156 | $expStr = explode( $start, $str, 2 ); |
@@ -162,6 +166,9 @@ discard block |
||
| 162 | 166 | return ''; |
| 163 | 167 | } |
| 164 | 168 | |
| 169 | + /** |
|
| 170 | + * @param string $html |
|
| 171 | + */ |
|
| 165 | 172 | protected function purifyHtml($html, $tags = null) |
| 166 | 173 | { |
| 167 | 174 | if ( class_exists( 'Tidy' ) && false ) { |
@@ -505,6 +505,7 @@ discard block |
||
| 505 | 505 | * @param string $oldList |
| 506 | 506 | * @param array $match |
| 507 | 507 | * @param array $index |
| 508 | + * @param string $type |
|
| 508 | 509 | * @return string |
| 509 | 510 | */ |
| 510 | 511 | protected function addListElementToContent($newList, $oldList, array $match, array $index, $type) |
@@ -588,7 +589,7 @@ discard block |
||
| 588 | 589 | /** |
| 589 | 590 | * Converts the list (li) content arrays to string. |
| 590 | 591 | * |
| 591 | - * @param array $listContentArray |
|
| 592 | + * @param string $listContentArray |
|
| 592 | 593 | * @return string |
| 593 | 594 | */ |
| 594 | 595 | protected function convertListContentArrayToString($listContentArray) |
@@ -8,6 +8,9 @@ |
||
| 8 | 8 | public $startInNew; |
| 9 | 9 | public $size; |
| 10 | 10 | |
| 11 | + /** |
|
| 12 | + * @param integer $size |
|
| 13 | + */ |
|
| 11 | 14 | public function __construct($startInOld, $startInNew, $size) |
| 12 | 15 | { |
| 13 | 16 | $this->startInOld = $startInOld; |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected $endTag; |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param null|string $listType |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($listType, $startTag, $endTag, $listItems = array(), $attributes = array()) |
| 18 | 21 | { |
| 19 | 22 | $this->listType = $listType; |
@@ -217,12 +217,18 @@ discard block |
||
| 217 | 217 | return $diffList; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | + /** |
|
| 221 | + * @param string $type |
|
| 222 | + */ |
|
| 220 | 223 | protected function isOpeningListTag($word, $type = null) |
| 221 | 224 | { |
| 222 | 225 | $filter = $type !== null ? array('<' . $type) : array('<ul', '<ol', '<dl'); |
| 223 | 226 | return in_array(substr($word, 0, 3), $filter); |
| 224 | 227 | } |
| 225 | 228 | |
| 229 | + /** |
|
| 230 | + * @param string $type |
|
| 231 | + */ |
|
| 226 | 232 | protected function isClosingListTag($word, $type = null) |
| 227 | 233 | { |
| 228 | 234 | $filter = $type !== null ? array('</' . $type) : array('</ul', '</ol', '</dl'); |
@@ -230,6 +236,9 @@ discard block |
||
| 230 | 236 | return in_array(substr($word, 0, 4), $filter); |
| 231 | 237 | } |
| 232 | 238 | |
| 239 | + /** |
|
| 240 | + * @param string $type |
|
| 241 | + */ |
|
| 233 | 242 | protected function isOpeningListItemTag($word, $type = null) |
| 234 | 243 | { |
| 235 | 244 | $filter = $type !== null ? array('<' . $type) : array('<li', '<dd', '<dt'); |
@@ -237,6 +246,9 @@ discard block |
||
| 237 | 246 | return in_array(substr($word, 0, 3), $filter); |
| 238 | 247 | } |
| 239 | 248 | |
| 249 | + /** |
|
| 250 | + * @param string $type |
|
| 251 | + */ |
|
| 240 | 252 | protected function isClosingListItemTag($word, $type = null) |
| 241 | 253 | { |
| 242 | 254 | $filter = $type !== null ? array('</' . $type) : array('</li', '</dd', '</dt'); |
@@ -157,6 +157,9 @@ discard block |
||
| 157 | 157 | $this->processInsertOperation( $operation, "diffmod" ); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $cssClass |
|
| 162 | + */ |
|
| 160 | 163 | protected function processInsertOperation($operation, $cssClass) |
| 161 | 164 | { |
| 162 | 165 | $text = array(); |
@@ -174,6 +177,9 @@ discard block |
||
| 174 | 177 | $this->insertTag( "ins", $cssClass, $text ); |
| 175 | 178 | } |
| 176 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $cssClass |
|
| 182 | + */ |
|
| 177 | 183 | protected function processDeleteOperation($operation, $cssClass) |
| 178 | 184 | { |
| 179 | 185 | $text = array(); |
@@ -213,6 +219,10 @@ discard block |
||
| 213 | 219 | return $this->diffElements($oldText, $newText, $stripWrappingTags); |
| 214 | 220 | } |
| 215 | 221 | |
| 222 | + /** |
|
| 223 | + * @param string $oldText |
|
| 224 | + * @param string $newText |
|
| 225 | + */ |
|
| 216 | 226 | protected function diffElements($oldText, $newText, $stripWrappingTags = true) |
| 217 | 227 | { |
| 218 | 228 | $wrapStart = ''; |
@@ -235,6 +245,10 @@ discard block |
||
| 235 | 245 | return $wrapStart . $diff->build() . $wrapEnd; |
| 236 | 246 | } |
| 237 | 247 | |
| 248 | + /** |
|
| 249 | + * @param string $oldText |
|
| 250 | + * @param string $newText |
|
| 251 | + */ |
|
| 238 | 252 | protected function diffList($oldText, $newText) |
| 239 | 253 | { |
| 240 | 254 | $diff = new ListDiffNew($oldText, $newText, $this->encoding, $this->specialCaseTags, $this->groupDiffs); |
@@ -298,6 +312,9 @@ discard block |
||
| 298 | 312 | return null; |
| 299 | 313 | } |
| 300 | 314 | |
| 315 | + /** |
|
| 316 | + * @param string $text |
|
| 317 | + */ |
|
| 301 | 318 | protected function isListPlaceholder($text) |
| 302 | 319 | { |
| 303 | 320 | return $this->isPlaceholderType($text, array('ol', 'dl', 'ul')); |
@@ -338,6 +355,10 @@ discard block |
||
| 338 | 355 | return in_array($text, $criteria, $strict); |
| 339 | 356 | } |
| 340 | 357 | |
| 358 | + /** |
|
| 359 | + * @param Operation $operation |
|
| 360 | + * @param integer $posInNew |
|
| 361 | + */ |
|
| 341 | 362 | protected function findIsolatedDiffTagsInOld($operation, $posInNew) |
| 342 | 363 | { |
| 343 | 364 | $offset = $posInNew - $operation->startInNew; |
@@ -345,6 +366,9 @@ discard block |
||
| 345 | 366 | return $this->oldIsolatedDiffTags[$operation->startInOld + $offset]; |
| 346 | 367 | } |
| 347 | 368 | |
| 369 | + /** |
|
| 370 | + * @param string $tag |
|
| 371 | + */ |
|
| 348 | 372 | protected function insertTag($tag, $cssClass, &$words) |
| 349 | 373 | { |
| 350 | 374 | while (true) { |
@@ -406,11 +430,17 @@ discard block |
||
| 406 | 430 | return $condition == 'tag' ? $this->isTag( $word ) : !$this->isTag( $word ); |
| 407 | 431 | } |
| 408 | 432 | |
| 433 | + /** |
|
| 434 | + * @param string $text |
|
| 435 | + */ |
|
| 409 | 436 | protected function wrapText($text, $tagName, $cssClass) |
| 410 | 437 | { |
| 411 | 438 | return sprintf( '<%1$s class="%2$s">%3$s</%1$s>', $tagName, $cssClass, $text ); |
| 412 | 439 | } |
| 413 | 440 | |
| 441 | + /** |
|
| 442 | + * @param string $condition |
|
| 443 | + */ |
|
| 414 | 444 | protected function extractConsecutiveWords(&$words, $condition) |
| 415 | 445 | { |
| 416 | 446 | $indexOfFirstTag = null; |
@@ -503,6 +533,12 @@ discard block |
||
| 503 | 533 | return $matchingBlocks; |
| 504 | 534 | } |
| 505 | 535 | |
| 536 | + /** |
|
| 537 | + * @param integer $startInOld |
|
| 538 | + * @param integer $endInOld |
|
| 539 | + * @param integer $startInNew |
|
| 540 | + * @param integer $endInNew |
|
| 541 | + */ |
|
| 506 | 542 | protected function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endInNew, &$matchingBlocks) |
| 507 | 543 | { |
| 508 | 544 | $match = $this->findMatch( $startInOld, $endInOld, $startInNew, $endInNew ); |