ZenMagick 0.9.8


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

Class ZMFilePatcher

ZMObject
└─ZMFilePatcher

public class ZMFilePatcher
extends ZMObject

Handle patches for a single file.

Author:
DerManoMann
Version:
$Id: ZMFilePatcher.php 2669 2009-12-02 21:29:59Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMFilePatcher(string filename, array patch, string target)

Create new patcher.

Method Summary
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
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

\core\utils\ZMFilePatcher.php at line 45

ZMFilePatcher

public ZMFilePatcher(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.

Method Detail

\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.8