|
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()
Constructor
The constructor is protected to force the use of FilesystemPatcher::getInstance()
- Depuis
- 3.0.0
◆ add()
Add a unified diff string to the patcher
- Paramètres
-
string | $udiff | Unified diff input string |
string | $root | The files root path |
string | $strip | The number of '/' to strip |
- Renvoie
- FilesystemPatcher $this for chaining
- Depuis
- 3.0.0
Références $root, et DIRECTORY_SEPARATOR.
◆ addFile()
addFile |
( |
|
$filename, |
|
|
|
$root = JPATH_BASE , |
|
|
|
$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 |
string | $strip | The number of '/' to strip |
- Renvoie
- FilesystemPatcher $this for chaining
- Depuis
- 3.0.0
Références $root.
◆ 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
- 3.0.0
- Exceptions
-
Références elseif, Path\removeRoot(), et Text\sprintf().
◆ 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
- 3.0.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
- 3.0.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
- 3.0.0
◆ getInstance()
Method to get a patcher
- Renvoie
- FilesystemPatcher an instance of the patcher
- Depuis
- 3.0.0
◆ getSource()
Get the lines of a source file
- Paramètres
-
string | $src | The path of a file |
- Renvoie
- array The lines of the source file
- Depuis
- 3.0.0
Références null.
◆ reset()
Reset the pacher
- Renvoie
- FilesystemPatcher This object for chaining
- Depuis
- 3.0.0
◆ splitLines()
static splitLines |
( |
|
$data | ) |
|
|
staticprotected |
Separate CR or CRLF lines
- Paramètres
-
- Renvoie
- array The lines of the inputdestination file
- Depuis
- 3.0.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' |
Regular expression for searching destination files
◆ HUNK
const HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A' |
Regular expression for searching hunks of differences
◆ SPLIT
const SPLIT = '/(\r\n)|(\r)|(\n)/' |
Regular expression for splitting lines
◆ 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' |
Regular expression for searching source files
La documentation de cette classe a été générée à partir du fichier suivant :