Text_Diff::_check()publicWP 1.0

Checks a diff for validity.

This is here only for debugging purposes.

{} Это метод класса: Text_Diff{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$Text_Diff = new Text_Diff();
$Text_Diff->_check( $from_lines, $to_lines );
$from_lines (обязательный)
-
$to_lines (обязательный)
-

Код Text_Diff::_check() WP 6.0.2

function _check($from_lines, $to_lines)
{
    if (serialize($from_lines) != serialize($this->getOriginal())) {
        trigger_error("Reconstructed original does not match", E_USER_ERROR);
    }
    if (serialize($to_lines) != serialize($this->getFinal())) {
        trigger_error("Reconstructed final does not match", E_USER_ERROR);
    }

    $rev = $this->reverse();
    if (serialize($to_lines) != serialize($rev->getOriginal())) {
        trigger_error("Reversed original does not match", E_USER_ERROR);
    }
    if (serialize($from_lines) != serialize($rev->getFinal())) {
        trigger_error("Reversed final does not match", E_USER_ERROR);
    }

    $prevtype = null;
    foreach ($this->_edits as $edit) {
        if ($edit instanceof $prevtype) {
            trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
        }
        $prevtype = get_class($edit);
    }

    return true;
}