[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/includes/diff/ -> diff.php (summary)

(no description)

Copyright: (c) 2006 phpBB Group
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id$
File Size: 1148 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 classes

diff:: (11 methods):
  diff()
  get_diff()
  count_added_lines()
  count_deleted_lines()
  reverse()
  is_empty()
  lcs()
  get_original()
  get_final()
  trim_newlines()
  _check()

mapped_diff:: (1 method):
  mapped_diff()

diff_op:: (3 methods):
  reverse()
  norig()
  nfinal()

diff_op_copy:: (2 methods):
  diff_op_copy()
  reverse()

diff_op_delete:: (2 methods):
  diff_op_delete()
  reverse()

diff_op_add:: (2 methods):
  diff_op_add()
  reverse()

diff_op_change:: (2 methods):
  diff_op_change()
  reverse()

diff3:: (8 methods):
  diff3()
  get_num_conflicts()
  get_conflicts_content()
  merged_output()
  merged_new_output()
  merged_orig_output()
  get_conflicts()
  _diff3()

diff3_op:: (6 methods):
  diff3_op()
  merged()
  is_conflict()
  solve_prepare()
  _compare_conflict_seq()
  solve_conflict()

diff3_op_copy:: (3 methods):
  diff3_op_copy()
  merged()
  is_conflict()

diff3_block_builder:: (8 methods):
  diff3_block_builder()
  input()
  out1()
  out2()
  is_empty()
  finish()
  _init()
  _append()


Class: diff  - X-Ref

Code from pear.php.net, Text_Diff-1.1.0 package
http://pear.php.net/package/Text_Diff/

Modified by phpBB Group to meet our coding standards
and being able to integrate into phpBB

General API for generating and formatting diffs - the differences between
two sequences of strings.

Copyright 2004 Geoffrey T. Dairiki <dairiki@dairiki.org>
Copyright 2004-2008 The Horde Project (http://www.horde.org/)

diff(&$from_content, &$to_content, $preserve_cr = true)   X-Ref
Computes diffs between sequences of strings.

param: array $from_lines  An array of strings. Typically these are lines from a file.
param: array $to_lines    An array of strings.

get_diff()   X-Ref
Returns the array of differences.


count_added_lines()   X-Ref
returns the number of new (added) lines in a given diff.

return: integer The number of new lines

count_deleted_lines()   X-Ref
Returns the number of deleted (removed) lines in a given diff.

return: integer The number of deleted lines

reverse()   X-Ref
Computes a reversed diff.

Example:
<code>
$diff = new diff($lines1, $lines2);
$rev = $diff->reverse();
</code>

return: diff  A Diff object representing the inverse of the original diff.

is_empty()   X-Ref
Checks for an empty diff.

return: boolean  True if two sequences were identical.

lcs()   X-Ref
Computes the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposes.

return: integer  The length of the LCS.

get_original()   X-Ref
Gets the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

return: array  The original sequence of strings.

get_final()   X-Ref
Gets the final set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

return: array  The sequence of strings.

trim_newlines(&$line, $key)   X-Ref
Removes trailing newlines from a line of text. This is meant to be used with array_walk().

param: string &$line  The line to trim.
param: integer $key  The index of the line in the array. Not used.

_check($from_lines, $to_lines)   X-Ref
Checks a diff for validity.

This is here only for debugging purposes.

Class: mapped_diff  - X-Ref


mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)   X-Ref
Computes a diff between sequences of strings.

This can be used to compute things like case-insensitve diffs, or diffs
which ignore changes in white-space.

param: array $from_lines         An array of strings.
param: array $to_lines           An array of strings.
param: array $mapped_from_lines  This array should have the same size number of elements as $from_lines.
param: array $mapped_to_lines    This array should have the same number of elements as $to_lines.

Class: diff_op  - X-Ref


reverse()   X-Ref
No description

norig()   X-Ref
No description

nfinal()   X-Ref
No description

Class: diff_op_copy  - X-Ref


diff_op_copy($orig, $final = false)   X-Ref
No description

reverse()   X-Ref
No description

Class: diff_op_delete  - X-Ref


diff_op_delete($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: diff_op_add  - X-Ref


diff_op_add($lines)   X-Ref
No description

reverse()   X-Ref
No description

Class: diff_op_change  - X-Ref


diff_op_change($orig, $final)   X-Ref
No description

reverse()   X-Ref
No description

Class: diff3  - X-Ref

A class for computing three way diffs.

diff3(&$orig, &$final1, &$final2, $preserve_cr = true)   X-Ref
Computes diff between 3 sequences of strings.

param: array $orig    The original lines to use.
param: array $final1  The first version to compare to.
param: array $final2  The second version to compare to.

get_num_conflicts()   X-Ref
Return number of conflicts


get_conflicts_content($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN')   X-Ref
Get conflicts content for download. This is generally a merged file, but preserving conflicts and adding explanations to it.
A user could then go through this file, search for the conflicts and changes the code accordingly.

param: string $label1 the cvs file version/label from the original set of lines
param: string $label2 the cvs file version/label from the new set of lines
param: string $label_sep the explanation between label1 and label2 - more of a helper for the user
return: mixed the merged output

merged_output()   X-Ref
Return merged output (used by the renderer)

return: mixed the merged output

merged_new_output()   X-Ref
Merge the output and use the new file code for conflicts


merged_orig_output()   X-Ref
Merge the output and use the original file code for conflicts


get_conflicts()   X-Ref
Get conflicting block(s)


_diff3(&$edits1, &$edits2)   X-Ref


Class: diff3_op  - X-Ref


diff3_op($orig = false, $final1 = false, $final2 = false)   X-Ref
No description

merged()   X-Ref
No description

is_conflict()   X-Ref
No description

solve_prepare()   X-Ref
Function to prepare the arrays for comparing - we want to skip over newline changes

author: acydburn

_compare_conflict_seq($orig, $final1, $final2 = false)   X-Ref
Find code portions from $orig in $final1 and use $final2 as merged instance if provided

author: acydburn

solve_conflict()   X-Ref
Tries to solve conflicts aggressively based on typical "assumptions"

author: acydburn

Class: diff3_op_copy  - X-Ref


diff3_op_copy($lines = false)   X-Ref
No description

merged()   X-Ref
No description

is_conflict()   X-Ref
No description

Class: diff3_block_builder  - X-Ref


diff3_block_builder()   X-Ref
No description

input($lines)   X-Ref
No description

out1($lines)   X-Ref
No description

out2($lines)   X-Ref
No description

is_empty()   X-Ref
No description

finish()   X-Ref
No description

_init()   X-Ref
No description

_append(&$array, $lines)   X-Ref
No description



Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1