ZenMagick 0.9.10


org.zenmagick.core.utils\ZMFilePatcher
core\utils\ZMFilePatcher.php at line 30

Class ZMFilePatcher

ZMObject
└─ZMFilePatcher

public class ZMFilePatcher
extends ZMObject

Handle patches for a single file.

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct(string filename, array patch, string target)

Create new patcher.

protected array

applyPatch(array lines)

Apply the patch to the given lines.

protected array

getLines()

Get the file content as single lines.

boolean

isOpen()

Checks if this patch can still be applied.

boolean

patch()

Do patch.

protected boolean

putLines(array lines)

Write the given lines.

protected array

revertPatch(array lines)

Revert the patch to the given lines.

boolean

undo()

Undo.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

core\utils\ZMFilePatcher.php at line 44

__construct

public void __construct(string filename, array patch, string target)

Create new patcher.

Parameters:
filename - The file to patch.
patch - The patch information.
target - Optional target filename; default is null to update filename.

core\utils\ZMFilePatcher.php at line 113

applyPatch

protected array applyPatch(array lines)

Apply the patch to the given lines.

Parameters:
lines - Contents as separate lines.
Returns:
The modified array if changes have been made, null if unchanged.

core\utils\ZMFilePatcher.php at line 66

getLines

protected array getLines()

Get the file content as single lines.

Returns:
An array of lines.

core\utils\ZMFilePatcher.php at line 270

isOpen

public boolean isOpen()

Checks if this patch can still be applied.

Returns:
true if this patch can still be applied.

core\utils\ZMFilePatcher.php at line 279

patch

public boolean patch()

Do patch.

Returns:
true if patching was successful (or skipped), false if not.

core\utils\ZMFilePatcher.php at line 89

putLines

protected boolean putLines(array lines)

Write the given lines.

Parameters:
lines - The lines to write.
Returns:
true if successful, false if not.

core\utils\ZMFilePatcher.php at line 180

revertPatch

protected array revertPatch(array lines)

Revert the patch to the given lines.

Parameters:
lines - Contents as separate lines.
Returns:
The modified array if changes have been made, null if unchanged.

core\utils\ZMFilePatcher.php at line 300

undo

public boolean undo()

Undo.

Returns:
true if the undo was successful (or skipped), false if not.

ZenMagick 0.9.10