@@ -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 ) { |
@@ -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(); |
@@ -191,6 +197,10 @@ discard block |
||
| 191 | 197 | $this->insertTag( "del", $cssClass, $text ); |
| 192 | 198 | } |
| 193 | 199 | |
| 200 | + /** |
|
| 201 | + * @param string $oldText |
|
| 202 | + * @param string $newText |
|
| 203 | + */ |
|
| 194 | 204 | protected function diffElements($oldText, $newText, $stripWrappingTags = true) |
| 195 | 205 | { |
| 196 | 206 | $wrapStart = ''; |
@@ -213,6 +223,10 @@ discard block |
||
| 213 | 223 | return $wrapStart . $diff->build() . $wrapEnd; |
| 214 | 224 | } |
| 215 | 225 | |
| 226 | + /** |
|
| 227 | + * @param string $oldText |
|
| 228 | + * @param string $newText |
|
| 229 | + */ |
|
| 216 | 230 | protected function diffList($oldText, $newText) |
| 217 | 231 | { |
| 218 | 232 | $diff = new ListDiff($oldText, $newText, $this->encoding, $this->specialCaseTags, $this->groupDiffs); |
@@ -263,6 +277,9 @@ discard block |
||
| 263 | 277 | return $this->oldIsolatedDiffTags[$operation->startInOld + $offset]; |
| 264 | 278 | } |
| 265 | 279 | |
| 280 | + /** |
|
| 281 | + * @param string $tag |
|
| 282 | + */ |
|
| 266 | 283 | protected function insertTag($tag, $cssClass, &$words) |
| 267 | 284 | { |
| 268 | 285 | while (true) { |
@@ -324,11 +341,17 @@ discard block |
||
| 324 | 341 | return $condition == 'tag' ? $this->isTag( $word ) : !$this->isTag( $word ); |
| 325 | 342 | } |
| 326 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $text |
|
| 346 | + */ |
|
| 327 | 347 | protected function wrapText($text, $tagName, $cssClass) |
| 328 | 348 | { |
| 329 | 349 | return sprintf( '<%1$s class="%2$s">%3$s</%1$s>', $tagName, $cssClass, $text ); |
| 330 | 350 | } |
| 331 | 351 | |
| 352 | + /** |
|
| 353 | + * @param string $condition |
|
| 354 | + */ |
|
| 332 | 355 | protected function extractConsecutiveWords(&$words, $condition) |
| 333 | 356 | { |
| 334 | 357 | $indexOfFirstTag = null; |
@@ -420,6 +443,12 @@ discard block |
||
| 420 | 443 | return $matchingBlocks; |
| 421 | 444 | } |
| 422 | 445 | |
| 446 | + /** |
|
| 447 | + * @param integer $startInOld |
|
| 448 | + * @param integer $endInOld |
|
| 449 | + * @param integer $startInNew |
|
| 450 | + * @param integer $endInNew |
|
| 451 | + */ |
|
| 423 | 452 | protected function findMatchingBlocks($startInOld, $endInOld, $startInNew, $endInNew, &$matchingBlocks) |
| 424 | 453 | { |
| 425 | 454 | $match = $this->findMatch( $startInOld, $endInOld, $startInNew, $endInNew ); |
@@ -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'); |