Text_Diff_Engine_shell::_getLines()publicWP 1.0

Get lines from either the old or new text

Method of the class: Text_Diff_Engine_shell{}

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

Array. The chopped lines

Usage

$Text_Diff_Engine_shell = new Text_Diff_Engine_shell();
$Text_Diff_Engine_shell->_getLines( $text_lines, $line_no, $end );
$text_lines(array) (required) (passed by reference — &)
Either $from_lines or $to_lines (passed by reference).
$line_no(int) (required) (passed by reference — &)
Current line number (passed by reference).
$end(int)
Optional end line, when we want to chop more than one line.
Default: false

Text_Diff_Engine_shell::_getLines() code WP 6.5.2

function _getLines(&$text_lines, &$line_no, $end = false)
{
    if (!empty($end)) {
        $lines = array();
        // We can shift even more
        while ($line_no <= $end) {
            array_push($lines, array_shift($text_lines));
            $line_no++;
        }
    } else {
        $lines = array(array_shift($text_lines));
        $line_no++;
    }

    return $lines;
}