Class SebastianBergmann\Diff\Differ

InheritanceSebastianBergmann\Diff\Differ

Diff implementation.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() SebastianBergmann\Diff\Differ
diff() Returns the diff between two arrays or strings as string. SebastianBergmann\Diff\Differ
diffToArray() Returns the diff between two arrays or strings as array. SebastianBergmann\Diff\Differ

Method Details

__construct() public method

public void __construct ( $header "--- Original\n+++ New\n", $showNonDiffLines true )
$header string
$showNonDiffLines
diff() public method

Returns the diff between two arrays or strings as string.

public string diff ( $from, $to, SebastianBergmann\Diff\LCS\LongestCommonSubsequence $lcs null )
$from array|string
$to array|string
$lcs SebastianBergmann\Diff\LCS\LongestCommonSubsequence
diffToArray() public method

Returns the diff between two arrays or strings as array.

Each array element contains two elements:

  • [0] => string $token
  • [1] => 2|1|0

  • 2: REMOVED: $token was removed from $from
  • 1: ADDED: $token was added to $from
  • 0: OLD: $token is not changed in $to
public array diffToArray ( $from, $to, SebastianBergmann\Diff\LCS\LongestCommonSubsequence $lcs null )
$from array|string
$to array|string
$lcs SebastianBergmann\Diff\LCS\LongestCommonSubsequence