ZenMagick 0.9.8


org.zenmagick.core.utils.ZMPhpPackagePacker
\core\utils\ZMPhpPackagePacker.php at line 35

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
Version:
$Id: ZMPhpPackagePacker.php 2610 2009-11-20 02:45:25Z dermanomann $

Field Summary
protected mixed

$outputFilename

protected mixed

$rootFolder

protected mixed

$tempFolder

protected mixed

$treeMap

Constructor Summary

ZMPhpPackagePacker(string root, string out, string temp)

Create new instance.

Method Summary
void

clean()

Clean up temp stuff.

protected void

compressFiles(boolean strip)

Compress all prepared files.

boolean

dropInclude(string line)

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

array

finalizeDependencies(array dependencies, array files)

Finalise dependencies.

protected array

getClassInfo(string source)

Get class info.

boolean

ignoreFile(string file)

Decide whether a ignore a file completely or not.

boolean

isResolved(string class, int level, array files)

Decide whether a class dependencies are resolved or not.

void

packFiles(boolean strip)

Pack all.

protected void

prepareFiles()

Prepare the original files to be processed by ZMPhpCompressor.

void

setDebug(boolean debug)

Set the debug flag.

void

setTemp(string temp)

Set the temp folder.

Field Detail

\core\utils\ZMPhpPackagePacker.php at line 37

outputFilename

protected mixed $outputFilename

\core\utils\ZMPhpPackagePacker.php at line 36

rootFolder

protected mixed $rootFolder

\core\utils\ZMPhpPackagePacker.php at line 38

tempFolder

protected mixed $tempFolder

\core\utils\ZMPhpPackagePacker.php at line 40

treeMap

protected mixed $treeMap

Constructor Detail

\core\utils\ZMPhpPackagePacker.php at line 50

ZMPhpPackagePacker

public ZMPhpPackagePacker(string root, string out, string temp)

Create new instance.

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

Method Detail

\core\utils\ZMPhpPackagePacker.php at line 145

clean

public void clean()

Clean up temp stuff.


\core\utils\ZMPhpPackagePacker.php at line 331

compressFiles

protected void compressFiles(boolean strip)

Compress all prepared files.

Parameters:
strip - If true, stript the files while compressing; default is true.

\core\utils\ZMPhpPackagePacker.php at line 124

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\ZMPhpPackagePacker.php at line 88

finalizeDependencies

public array finalizeDependencies(array dependencies, array files)

Finalise dependencies.

Callback to manipulate the computed dependencies.

Parameters:
dependencies - The computed dependencies.
files - List of all files as returned by ZMLoader::findIncludes().
Returns:
The final dependencies.

\core\utils\ZMPhpPackagePacker.php at line 176

getClassInfo

protected array getClassInfo(string source)

Get class info.

Parameters:
source - The file source.
Returns:
Two element array containing the list of implemented interfaces and parent class.

\core\utils\ZMPhpPackagePacker.php at line 114

ignoreFile

public boolean ignoreFile(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\ZMPhpPackagePacker.php at line 102

isResolved

public boolean isResolved(string class, int level, array files)

Decide whether a class dependencies are resolved or not.

Callback to allow custom handling, for example in case of circular references.

Parameters:
class - The class name.
level - The current inheritence level (nested folder depth).
files - List of all files as returned by ZMLoader::findIncludes().
Returns:
true, if the class should be considered cleared of all dependencies.

\core\utils\ZMPhpPackagePacker.php at line 133

packFiles

public void packFiles(boolean strip)

Pack all.

Parameters:
strip - If true, stript the files while compressing; default is true.

\core\utils\ZMPhpPackagePacker.php at line 208

prepareFiles

protected void prepareFiles()

Prepare the original files to be processed by ZMPhpCompressor.


\core\utils\ZMPhpPackagePacker.php at line 75

setDebug

public void setDebug(boolean debug)

Set the debug flag.

Parameters:
debug - The new debug value.

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