Menu

## Differ
in package

Differ.php : 36

### Table of Contents

ADDED = 1
DIFF_LINE_END_WARNING = 3
NO_LINE_END_EOF_WARNING = 4
OLD = 0
REMOVED = 2
$outputBuilder : DiffOutputBuilderInterface
__construct() : mixed
diff() : string
  Returns the diff between two arrays or strings as string.
diffToArray() : array<string|int, mixed>
  Returns the diff between two arrays or strings as array.
calculateEstimatedFootprint() : float|int
  Calculates the estimated memory footprint for the DP-based method.
detectUnmatchedLineEndings() : bool
  Returns true if line ends don't match in a diff.
getArrayDiffParted() : array<string|int, mixed>
getLinebreak() : string
normalizeDiffInput() : array<string|int, mixed>|string
  Casts variable to string if it is not a string or array.
selectLcsImplementation() : LongestCommonSubsequenceCalculator
splitStringByLines() : array<string|int, mixed>
  Checks if input is string, if so it will split it line-by-line.

### Constants

#### ADDED

Differ.php : 40
`public mixed ADDED = 1`

#### DIFF_LINE_END_WARNING

Differ.php : 44
`public mixed DIFF_LINE_END_WARNING = 3`

#### NO_LINE_END_EOF_WARNING

Differ.php : 46
`public mixed NO_LINE_END_EOF_WARNING = 4`

#### OLD

Differ.php : 38
`public mixed OLD = 0`

#### REMOVED

Differ.php : 42
`public mixed REMOVED = 2`

### Properties

#### $outputBuilder

Differ.php : 51
`private DiffOutputBuilderInterface $outputBuilder`

### Methods

#### __construct()

Differ.php : 58
`public __construct([DiffOutputBuilderInterface $outputBuilder = null ]) : mixed`

##### Parameters

$outputBuilder : DiffOutputBuilderInterface = null

##### Tags

throws
  InvalidArgumentException

##### Return values

mixed —

#### diff()

Differ.php : 85

Returns the diff between two arrays or strings as string.

`public diff(array<string|int, mixed>|string $from, array<string|int, mixed>|string $to[, LongestCommonSubsequenceCalculator $lcs = null ]) : string`

##### Parameters

$from : array<string|int, mixed>|string
$to : array<string|int, mixed>|string
$lcs : LongestCommonSubsequenceCalculator = null

##### Return values

string —

#### diffToArray()

Differ.php : 111

Returns the diff between two arrays or strings as array.

`public diffToArray(array<string|int, mixed>|string $from, array<string|int, mixed>|string $to[, LongestCommonSubsequenceCalculator $lcs = null ]) : array<string|int, mixed>`

Each array element contains two elements:

- [0] => mixed $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

##### Parameters

$from : array<string|int, mixed>|string
$to : array<string|int, mixed>|string
$lcs : LongestCommonSubsequenceCalculator = null

##### Return values

array<string|int, mixed> —

#### calculateEstimatedFootprint()

Differ.php : 217

Calculates the estimated memory footprint for the DP-based method.

`private calculateEstimatedFootprint(array<string|int, mixed> $from, array<string|int, mixed> $to) : float|int`

##### Parameters

$from : array<string|int, mixed>
$to : array<string|int, mixed>

##### Return values

float|int —

#### detectUnmatchedLineEndings()

Differ.php : 227

Returns true if line ends don't match in a diff.

`private detectUnmatchedLineEndings(array<string|int, mixed> $diff) : bool`

##### Parameters

$diff : array<string|int, mixed>

##### Return values

bool —

#### getArrayDiffParted()

Differ.php : 288
`private static getArrayDiffParted(array<string|int, mixed> &$from, array<string|int, mixed> &$to) : array<string|int, mixed>`

##### Parameters

$from : array<string|int, mixed>
$to : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### getLinebreak()

Differ.php : 265
`private getLinebreak(mixed $line) : string`

##### Parameters

$line : mixed

##### Return values

string —

#### normalizeDiffInput()

Differ.php : 180

Casts variable to string if it is not a string or array.

`private normalizeDiffInput(mixed $input) : array<string|int, mixed>|string`

##### Parameters

$input : mixed

##### Return values

array<string|int, mixed>|string —

#### selectLcsImplementation()

Differ.php : 197
`private selectLcsImplementation(array<string|int, mixed> $from, array<string|int, mixed> $to) : LongestCommonSubsequenceCalculator`

##### Parameters

$from : array<string|int, mixed>
$to : array<string|int, mixed>

##### Return values

LongestCommonSubsequenceCalculator —

#### splitStringByLines()

Differ.php : 192

Checks if input is string, if so it will split it line-by-line.

`private splitStringByLines(string $input) : array<string|int, mixed>`

##### Parameters

$input : string

##### Return values

array<string|int, mixed> —

## Search results