ZenMagick 0.9.10


org.zenmagick.core.utils.packer\ZMPhpPackagePacker
core\utils\packer\ZMPhpPackagePacker.php at line 33

Class ZMPhpPackagePacker

ZMPhpPackagePacker

public class ZMPhpPackagePacker

Analyze dependencies of a given PHP package (folder tree), resolve and compress.

This class is build on top of ZMPhpCompressor. It adds the ability to resolve include and require directives. It also takes care of missing PHP close tags ?>.

Author:
DerManoMann

Field Summary
protected mixed

$outputFilename_

protected mixed

$rootFolder_

protected mixed

$tempFolder_

protected mixed

$treeMap_

Method Summary
void

__construct(string root, string out, string temp)

Create new instance.

void

clean()

Clean up temp stuff.

protected void

compressFiles(boolean stripCode, boolean stripRef)

Compress all prepared files.

boolean

dropInclude(string line)

Decide whether a drop an include/require line or not.

protected array

getFileList()

Get a list of all files to process.

array

getPreResolved()

Get a list of class/interface names to be assumed resolved.

boolean

ignoreFile(mixed filename, string file)

Decide whether a ignore a file completely or not.

void

packFiles(boolean strip, boolean stripRef)

Pack all.

array

patchFile(string filename, mixed lines)

Allow custom file patching.

protected void

prepareFiles()

Prepare the original files to be processed by ZMPhpCompressor.

void

setDebug(boolean debug)

Set the debug flag.

void

setResolveInheritance(boolean resolveInheritance)

Set the resolveInheritance flag.

void

setTemp(string temp)

Set the temp folder.

Field Detail

core\utils\packer\ZMPhpPackagePacker.php at line 35

outputFilename_

protected mixed $outputFilename_

core\utils\packer\ZMPhpPackagePacker.php at line 34

rootFolder_

protected mixed $rootFolder_ = true

core\utils\packer\ZMPhpPackagePacker.php at line 36

tempFolder_

protected mixed $tempFolder_

core\utils\packer\ZMPhpPackagePacker.php at line 38

treeMap_

protected mixed $treeMap_

Method Detail

core\utils\packer\ZMPhpPackagePacker.php at line 49

__construct

public void __construct(string root, string out, string temp)

Create new instance.

Parameters:
root - The root directory to pack; default is null.
out - The [full] output filename; default is null.
temp - A temp folder for transient files and folders; default is null.

core\utils\packer\ZMPhpPackagePacker.php at line 140

clean

public void clean()

Clean up temp stuff.


core\utils\packer\ZMPhpPackagePacker.php at line 228

compressFiles

protected void compressFiles(boolean stripCode, boolean stripRef)

Compress all prepared files.

Parameters:
stripCode - If true, strip the files while compressing.
stripRef - If true, strip code that uses references.

core\utils\packer\ZMPhpPackagePacker.php at line 118

dropInclude

public boolean dropInclude(string line)

Decide whether a drop an include/require line or not.

Parameters:
line - The line in question.
Returns:
true, if the include/require should be dropped.

core\utils\packer\ZMPhpPackagePacker.php at line 150

getFileList

protected array getFileList()

Get a list of all files to process.

Returns:
A list of file names.

core\utils\packer\ZMPhpPackagePacker.php at line 160

getPreResolved

public array getPreResolved()

Get a list of class/interface names to be assumed resolved.

The default implementation will return a list of predefined PHP standard and SPL exceptions and interfaces.

Returns:
A list of class/interface names.

core\utils\packer\ZMPhpPackagePacker.php at line 98

ignoreFile

public boolean ignoreFile(mixed filename, string file)

Decide whether a ignore a file completely or not.

Callback to allow custom handling, for example exclusion of files or folders.

Parameters:
file - The file name.
Returns:
true, if the file should be ignored.

core\utils\packer\ZMPhpPackagePacker.php at line 128

packFiles

public void packFiles(boolean strip, boolean stripRef)

Pack all.

Parameters:
strip - If true, stript the files while compressing.
stripRef - If true, strip code that uses references.

core\utils\packer\ZMPhpPackagePacker.php at line 108

patchFile

public array patchFile(string filename, mixed lines)

Allow custom file patching.

Parameters:
filename - The file name.
Returns:
The (patched) lines or null.

core\utils\packer\ZMPhpPackagePacker.php at line 178

prepareFiles

protected void prepareFiles()

Prepare the original files to be processed by ZMPhpCompressor.


core\utils\packer\ZMPhpPackagePacker.php at line 86

setDebug

public void setDebug(boolean debug)

Set the debug flag.

Parameters:
debug - The new debug value.

core\utils\packer\ZMPhpPackagePacker.php at line 77

setResolveInheritance

public void setResolveInheritance(boolean resolveInheritance)

Set the resolveInheritance flag.

Default is false - that should be enough for PEAR compatible packages.

Parameters:
resolveInheritance - if true try to resolve inheritance as determined by analysing the PHP source.

core\utils\packer\ZMPhpPackagePacker.php at line 63

setTemp

public void setTemp(string temp)

Set the temp folder.

Parameters:
temp - A temp folder for transient files and folders; default is null.

ZenMagick 0.9.10