ShellEngine
in package
implements
DiffEngineInterface
Class used internally by Diff to actually compute the diffs.
This class uses the Unix diff
program via shell_exec to compute the
differences between the two input arrays.
Copyright 2007-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Interfaces, Classes, Traits and Enums
- DiffEngineInterface
- Interface for Diff Engines
Table of Contents
- $diffCommand : string
- Path to the diff executable
- $fromLines : array<string|int, mixed>
- $toLines : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- diff() : OperationList
- Returns the array of differences.
- _getLines() : array<string|int, mixed>
- Get lines from either the old or new text
Properties
$diffCommand
Path to the diff executable
protected
string
$diffCommand
= 'diff'
$fromLines
private
array<string|int, mixed>
$fromLines
$toLines
private
array<string|int, mixed>
$toLines
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $fromLines, array<string|int, mixed> $toLines[, string $diffCommand = 'diff' ]) : mixed
Parameters
- $fromLines : array<string|int, mixed>
-
lines of text from old file
- $toLines : array<string|int, mixed>
-
lines of text from new file
- $diffCommand : string = 'diff'
-
The external diff tool to call
Return values
mixed —diff()
Returns the array of differences.
public
diff() : OperationList
Return values
OperationList —all changes made
_getLines()
Get lines from either the old or new text
protected
_getLines(array<string|int, mixed> &$text_lines, int &$line_no, int $end) : array<string|int, mixed>
Parameters
- $text_lines : array<string|int, mixed>
-
Either $from_lines or $to_lines
- $line_no : int
-
Current line number
- $end : int
-
Optional end line, when we want to chop more than one line.
Tags
Return values
array<string|int, mixed> —The chopped lines