protected WordLevelDiff::_split($lines)
File
- core/lib/Drupal/Component/Diff/WordLevelDiff.php, line 24
Class
- WordLevelDiff
- @todo document @private @subpackage DifferenceEngine
Namespace
Drupal\Component\Diff
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | protected function _split( $lines ) { $words = array (); $stripped = array (); $first = TRUE; foreach ( $lines as $line ) { // If the line is too long, just pretend the entire line is one big word // This prevents resource exhaustion problems if ( $first ) { $first = FALSE; } else { $words [] = "\n" ; $stripped [] = "\n" ; } if (Unicode:: strlen ( $line ) > $this ::MAX_LINE_LENGTH) { $words [] = $line ; $stripped [] = $line ; } else { if (preg_match_all( '/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs' , $line , $m )) { $words = array_merge ( $words , $m [0]); $stripped = array_merge ( $stripped , $m [1]); } } } return array ( $words , $stripped ); } |
Please login to continue.