|
const | SRC_FILE = '/^---\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A' |
|
const | DST_FILE = '/^\\+\\+\\+\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A' |
|
const | HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A' |
|
const | SPLIT = '/(\r\n)|(\r)|(\n)/' |
|
◆ __construct()
◆ add()
add |
( |
|
$udiff, |
|
|
|
$root, |
|
|
|
$strip = 0 |
|
) |
| |
Add a unified diff string to the patcher
- Paramètres
-
string | $udiff | Unified diff input string |
string | $root | The files root path |
integer | $strip | The number of '/' to strip |
- Renvoie
- Patcher $this for chaining
- Depuis
- 1.0
Références $root, et $this.
Référencé par Patcher\addFile().
◆ addFile()
addFile |
( |
|
$filename, |
|
|
|
$root, |
|
|
|
$strip = 0 |
|
) |
| |
Add a unified diff file to the patcher
- Paramètres
-
string | $filename | Path to the unified diff file |
string | $root | The files root path |
integer | $strip | The number of '/' to strip |
- Renvoie
- Patcher $this for chaining
- Depuis
- 1.0
Références $root, et Patcher\add().
◆ apply()
◆ applyHunk()
applyHunk |
( |
& |
$lines, |
|
|
|
$src, |
|
|
|
$dst, |
|
|
|
$srcLine, |
|
|
|
$srcSize, |
|
|
|
$dstLine, |
|
|
|
$dstSize |
|
) |
| |
|
protected |
Apply the patch
- Paramètres
-
array | $lines | The udiff array of lines |
string | $src | The source file |
string | $dst | The destination file |
string | $srcLine | The beginning of the patch for the source file |
string | $srcSize | The size of the patch for the source file |
string | $dstLine | The beginning of the patch for the destination file |
string | $dstSize | The size of the patch for the destination file |
- Renvoie
- void
- Depuis
- 1.0
- Exceptions
-
Références elseif, Patcher\getDestination(), Patcher\getSource(), et Path\removeRoot().
Référencé par Patcher\apply().
◆ findHeader()
static findHeader |
( |
& |
$lines, |
|
|
& |
$src, |
|
|
& |
$dst |
|
) |
| |
|
staticprotected |
Find the diff header
The internal array pointer of $lines is on the next line after the finding
- Paramètres
-
array | $lines | The udiff array of lines |
string | $src | The source file |
string | $dst | The destination file |
- Renvoie
- boolean TRUE in case of success, FALSE in case of failure
- Depuis
- 1.0
- Exceptions
-
◆ findHunk()
static findHunk |
( |
& |
$lines, |
|
|
& |
$srcLine, |
|
|
& |
$srcSize, |
|
|
& |
$dstLine, |
|
|
& |
$dstSize |
|
) |
| |
|
staticprotected |
Find the next hunk of difference
The internal array pointer of $lines is on the next line after the finding
- Paramètres
-
array | $lines | The udiff array of lines |
string | $srcLine | The beginning of the patch for the source file |
string | $srcSize | The size of the patch for the source file |
string | $dstLine | The beginning of the patch for the destination file |
string | $dstSize | The size of the patch for the destination file |
- Renvoie
- boolean TRUE in case of success, false in case of failure
- Depuis
- 1.0
- Exceptions
-
◆ getDestination()
& getDestination |
( |
|
$dst, |
|
|
|
$src |
|
) |
| |
|
protected |
Get the lines of a destination file
- Paramètres
-
string | $dst | The path of a destination file |
string | $src | The path of a source file |
- Renvoie
- array The lines of the destination file
- Depuis
- 1.0
Références Patcher\getSource().
Référencé par Patcher\applyHunk().
◆ getInstance()
Method to get a patcher
- Renvoie
- Patcher an instance of the patcher
- Depuis
- 1.0
◆ getSource()
◆ reset()
Reset the pacher
- Renvoie
- Patcher This object for chaining
- Depuis
- 1.0
Références $this.
◆ splitLines()
static splitLines |
( |
|
$data | ) |
|
|
staticprotected |
Separate CR or CRLF lines
- Paramètres
-
- Renvoie
- array The lines of the input destination file
- Depuis
- 1.0
Références $data.
◆ $destinations
◆ $instance
◆ $patches
◆ $removals
◆ $sources
◆ DST_FILE
const DST_FILE = '/^\\+\\+\\+\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A' |
◆ HUNK
const HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A' |
◆ SPLIT
const SPLIT = '/(\r\n)|(\r)|(\n)/' |
◆ SRC_FILE
const SRC_FILE = '/^---\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A' |
La documentation de cette classe a été générée à partir du fichier suivant :