PHP Class Netresearch\Composer\Patches\Patch

Show file Open project: netresearch/composer-patches-plugin Class Usage Examples

Protected Properties

Property Type Description
$checksum
$content string The content of the patch file
$fileAdditions array File additions inside the patch
$fileDeletions array File deletions/replacements inside the patch
$info stdClass Info object created by {@see PatchSet::process()}
$patchSet Netresearch\Composer\Patches\PatchSet

Public Methods

Method Description
__construct ( stdClass $info, Netresearch\Composer\Patches\PatchSet $patchSet ) Construct with $info from {@see PatchSet::process()}
__get ( string $name ) : string | mixed Get a info property
__isset ( string $name ) : string Check if a info property is set
apply ( string $toPath, boolean $dryRun = FALSE ) Apply the patch
getChecksum ( ) : string
getFileAdditions ( ) : type Get the files, added by this patch
getFileDeletions ( ) : array Get the files, deleted (or replaced) by this patch
revert ( string $toPath, boolean $dryRun = FALSE ) Revert the patch

Protected Methods

Method Description
executeProcess ( string $command, string $cwd, string $stdin, string &$stdout, string &$stderr = NULL ) : integer Process execution wrapper adapted from
getActionFiles ( string $action ) : array Find the file additions/deletions within the patch file
read ( ) : string Read in the patch
runCommand ( string $toPath, boolean $revert = FALSE, boolean $dryRun = FALSE ) Run the patch command
whichPatchCmd ( ) : string Locate the patch executable

Method Details

__construct() public method

Construct with $info from {@see PatchSet::process()}
public __construct ( stdClass $info, Netresearch\Composer\Patches\PatchSet $patchSet )
$info stdClass
$patchSet Netresearch\Composer\Patches\PatchSet

__get() public method

Get a info property
public __get ( string $name ) : string | mixed
$name string
return string | mixed

__isset() public method

Check if a info property is set
public __isset ( string $name ) : string
$name string
return string

apply() public method

Apply the patch
public apply ( string $toPath, boolean $dryRun = FALSE )
$toPath string
$dryRun boolean

executeProcess() protected method

Process execution wrapper adapted from
protected executeProcess ( string $command, string $cwd, string $stdin, string &$stdout, string &$stderr = NULL ) : integer
$command string
$cwd string
$stdin string
$stdout string
$stderr string
return integer

getActionFiles() protected method

Find the file additions/deletions within the patch file
protected getActionFiles ( string $action ) : array
$action string '-' or '+'
return array

getChecksum() public method

public getChecksum ( ) : string
return string

getFileAdditions() public method

Get the files, added by this patch
public getFileAdditions ( ) : type
return type

getFileDeletions() public method

Get the files, deleted (or replaced) by this patch
public getFileDeletions ( ) : array
return array

read() protected method

Read in the patch
protected read ( ) : string
return string

revert() public method

Revert the patch
public revert ( string $toPath, boolean $dryRun = FALSE )
$toPath string
$dryRun boolean

runCommand() protected method

Run the patch command
protected runCommand ( string $toPath, boolean $revert = FALSE, boolean $dryRun = FALSE )
$toPath string
$revert boolean
$dryRun boolean

whichPatchCmd() protected method

Locate the patch executable
protected whichPatchCmd ( ) : string
return string

Property Details

$checksum protected property

protected $checksum

$content protected property

The content of the patch file
protected string $content
return string

$fileAdditions protected property

File additions inside the patch
protected array $fileAdditions
return array

$fileDeletions protected property

File deletions/replacements inside the patch
protected array $fileDeletions
return array

$info protected property

Info object created by {@see PatchSet::process()}
protected stdClass $info
return stdClass

$patchSet protected property

protected PatchSet,Netresearch\Composer\Patches $patchSet
return Netresearch\Composer\Patches\PatchSet