RecipePatcher
in package
Table of Contents
- $filesystem : mixed
- $io : mixed
- $processExecutor : mixed
- $rootDir : mixed
- __construct() : mixed
- applyPatch() : bool
- Applies the patch. If it fails unexpectedly, an exception will be thrown.
- generatePatch() : RecipePatch
- _applyPatchFile() : mixed
- addMissingBlobs() : array<string|int, mixed>
- Adds git blobs for each original file.
- execute() : string
- generateBlobs() : array<string|int, mixed>
- getBlobPath() : string
- getIgnoredFiles() : array<string|int, mixed>
- writeFiles() : void
Properties
$filesystem
private
mixed
$filesystem
$io
private
mixed
$io
$processExecutor
private
mixed
$processExecutor
$rootDir
private
mixed
$rootDir
Methods
__construct()
public
__construct(string $rootDir, IOInterface $io) : mixed
Parameters
- $rootDir : string
- $io : IOInterface
Return values
mixed —applyPatch()
Applies the patch. If it fails unexpectedly, an exception will be thrown.
public
applyPatch(RecipePatch $patch) : bool
Parameters
- $patch : RecipePatch
Return values
bool —returns true if fully successful, false if conflicts were encountered
generatePatch()
public
generatePatch(array<string|int, mixed> $originalFiles, array<string|int, mixed> $newFiles) : RecipePatch
Parameters
- $originalFiles : array<string|int, mixed>
- $newFiles : array<string|int, mixed>
Return values
RecipePatch —_applyPatchFile()
private
_applyPatchFile(RecipePatch $patch) : mixed
Parameters
- $patch : RecipePatch
Return values
mixed —addMissingBlobs()
Adds git blobs for each original file.
private
addMissingBlobs(array<string|int, mixed> $blobs) : array<string|int, mixed>
For patching to work, each original file & contents needs to be available to git as a blob. This is because the patch contains the ref to the original blob, and git uses that to find the original file (which is needed for the 3-way merge).
Parameters
- $blobs : array<string|int, mixed>
Return values
array<string|int, mixed> —execute()
private
execute(string $command, string $cwd) : string
Parameters
- $command : string
- $cwd : string
Return values
string —generateBlobs()
private
generateBlobs(array<string|int, mixed> $originalFiles, string $originalFilesRoot) : array<string|int, mixed>
Parameters
- $originalFiles : array<string|int, mixed>
- $originalFilesRoot : string
Return values
array<string|int, mixed> —getBlobPath()
private
getBlobPath(string $gitRoot, string $hash) : string
Parameters
- $gitRoot : string
- $hash : string
Return values
string —getIgnoredFiles()
private
getIgnoredFiles(array<string|int, mixed> $fileNames) : array<string|int, mixed>
Parameters
- $fileNames : array<string|int, mixed>
Return values
array<string|int, mixed> —writeFiles()
private
writeFiles(array<string|int, mixed> $files, string $directory) : void
Parameters
- $files : array<string|int, mixed>
- $directory : string