class vB_Text_Diff

Finds the difference between two strings using a line as the atom.

Traits

Properties

array $data_old Array of atoms for the old string.
integer $data_old_len Size of the atoms of the old string (elements in the array)
array $data_new Array of atoms for the new string.
integer $data_new_len Size of the atoms of the new string (elements in the array)
integer $new_end_line Last new line since match state change
integer $old_end_line Last old line since match state change
$table
bool $output_progress Output progress to the browser? #34585

Methods

__sleep()

No description

__wakeup()

No description

__construct(string $data_old, string $data_new, bool $output_progress = false)

Constructor. Sets up the data.

populate_table()

Builds the table used to find the LCS of the old and new strings.

string
compress_row(array $row)

Compresses a row of the LCS table in order to reduce memory usage of the table.

array
decompress_row(string $row)

Decompresses a row of an LCS table into an array of records. Note that the indexing of the row begins at index -1 (for the sentinel values).

array
fetch_table()

Fetches the table created by populate_table().

array
fetch_diff()

Fetches an array of objects that holds both strings split up into sections such that a diff can be generated with it.

fetch_annotated_lines()

No description

process_matches($output, $match, $old_start_line, $new_start_line)

Processes an array of matching lines. Resets the $match array afterwards.

process_nonmatches($output, $text_old, $text_new, $old_start_line, $new_start_line)

Processes an array of nonmatching lines. Resets text arrays afterwards.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 91
__construct(string $data_old, string $data_new, bool $output_progress = false)

Constructor. Sets up the data.

Parameters

string $data_old Old data in string format.
string $data_new New data in string format.
bool $output_progress Whether or not to output progress to the browser. #34585

at line 117
populate_table()

Builds the table used to find the LCS of the old and new strings.

This is then used to build the diff.

at line 176
string compress_row(array $row)

Compresses a row of the LCS table in order to reduce memory usage of the table.

Parameters

array $row Array of entries in a row of the LCS table

Return Value

string A pipe delimited version of the row

at line 189
array decompress_row(string $row)

Decompresses a row of an LCS table into an array of records. Note that the indexing of the row begins at index -1 (for the sentinel values).

Parameters

string $row Compressed version of the row

Return Value

array Uncompressed version of the row; indexing begins at -1

at line 208
array fetch_table()

Fetches the table created by populate_table().

Populates it first if necessary.

Return Value

array The table

at line 223
array fetch_diff()

Fetches an array of objects that holds both strings split up into sections such that a diff can be generated with it.

Return Value

array Array of vB_Text_Diff_Entry objects

at line 297
fetch_annotated_lines()

at line 402
process_matches($output, $match, $old_start_line, $new_start_line)

Processes an array of matching lines. Resets the $match array afterwards.

Parameters

$output
$match
$old_start_line
$new_start_line

at line 424
process_nonmatches($output, $text_old, $text_new, $old_start_line, $new_start_line)

Processes an array of nonmatching lines. Resets text arrays afterwards.

Parameters

$output
$text_old
$text_new
$old_start_line
$new_start_line