public Diff::check($from_lines, $to_lines)
Check a Diff for validity.
This is here only for debugging purposes.
File
- core/lib/Drupal/Component/Diff/Diff.php, line 133
Class
- Diff
- Class representing a 'diff' between two sequences of strings. @todo document @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 28 | public function check( $from_lines , $to_lines ) { if (serialize( $from_lines ) != serialize( $this ->orig())) { trigger_error( "Reconstructed original doesn't match" , E_USER_ERROR); } if (serialize( $to_lines ) != serialize( $this ->closing())) { trigger_error( "Reconstructed closing doesn't match" , E_USER_ERROR); } $rev = $this ->reverse(); if (serialize( $to_lines ) != serialize( $rev ->orig())) { trigger_error( "Reversed original doesn't match" , E_USER_ERROR); } if (serialize( $from_lines ) != serialize( $rev ->closing())) { trigger_error( "Reversed closing doesn't match" , E_USER_ERROR); } $prevtype = 'none' ; foreach ( $this ->edits as $edit ) { if ( $prevtype == $edit ->type) { trigger_error( "Edit sequence is non-optimal" , E_USER_ERROR); } $prevtype = $edit ->type; } $lcs = $this ->lcs(); trigger_error( 'Diff okay: LCS = ' . $lcs , E_USER_NOTICE); } |
Please login to continue.