Text_Diff::_check()
Checks a diff for validity.
This is here only for debugging purposes.
Method of the class: Text_Diff{}
No Hooks.
Return
null
. Nothing (null).
Usage
$Text_Diff = new Text_Diff(); $Text_Diff->_check( $from_lines, $to_lines );
- $from_lines (required)
- -
- $to_lines (required)
- -
Text_Diff::_check() Text Diff:: check code WP 6.7.1
function _check($from_lines, $to_lines) { if (serialize($from_lines) != serialize($this->getOriginal())) { throw new Text_Exception("Reconstructed original does not match"); } if (serialize($to_lines) != serialize($this->getFinal())) { throw new Text_Exception("Reconstructed final does not match"); } $rev = $this->reverse(); if (serialize($to_lines) != serialize($rev->getOriginal())) { throw new Text_Exception("Reversed original does not match"); } if (serialize($from_lines) != serialize($rev->getFinal())) { throw new Text_Exception("Reversed final does not match"); } $prevtype = null; foreach ($this->_edits as $edit) { if ($prevtype !== null && $edit instanceof $prevtype) { throw new Text_Exception("Edit sequence is non-optimal"); } $prevtype = get_class($edit); } return true; }