45 list( $wordsBefore, $wordsBeforeStripped ) = $this->
split( $linesBefore );
46 list( $wordsAfter, $wordsAfterStripped ) = $this->
split( $linesAfter );
49 parent::__construct( $wordsBeforeStripped, $wordsAfterStripped );
57 for ( $i = 0; $i < $editCount; $i++ ) {
58 $orig = &$this->
edits[$i]->orig;
59 if ( is_array( $orig ) ) {
60 $orig = array_slice( $wordsBefore, $xi,
count( $orig ) );
61 $xi +=
count( $orig );
64 $closing = &$this->
edits[$i]->closing;
65 if ( is_array( $closing ) ) {
66 $closing = array_slice( $wordsAfter, $yi,
count( $closing ) );
67 $yi +=
count( $closing );
89 if ( preg_match_all(
'/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
91 foreach ( $m[0]
as $word ) {
94 foreach ( $m[1]
as $stripped_word ) {
95 $stripped[] = $stripped_word;
100 return [ $words, $stripped ];
109 foreach ( $this->
edits as $edit ) {
110 if ( $edit->type ==
'copy' ) {
112 } elseif ( $edit->orig ) {
113 $orig->addWords( $edit->orig,
'del' );
116 $lines = $orig->getLines();
127 foreach ( $this->
edits as $edit ) {
128 if ( $edit->type ==
'copy' ) {
129 $closing->
addWords( $edit->closing );
130 } elseif ( $edit->closing ) {
131 $closing->addWords( $edit->closing,
'ins' );
134 $lines = $closing->getLines();