Class

eZAutoloadGenerator

class eZAutoloadGenerator

Utility class for generating autoload arrays for eZ Publish.

The class can handle classes from the kernel and extensions.

Constants

MODE_NONE

Bitmask for searching in no files.

MODE_KERNEL

Bitmask for searhing in kernel files

MODE_EXTENSION

Bitmask for search in extension files

MODE_TESTS

Bitmask for searching in test files

MODE_SINGLE_EXTENSION

Bitmask for searching in a single extension only.

This mode is mutually exclusive from the other modes.

MODE_KERNEL_OVERRIDE

Bitmask for searching for kernel overrides.

This mode is mutually excluse from the other modes.

OUTPUT_PROGRESS_PHASE1

Represents the first phase of autoload generation, where the code searches for PHP source files.

OUTPUT_PROGRESS_PHASE2

Represents the second phase of autoload generation, where the code tokenizes the found PHP files to look for classes and interfaces.

DEFAULT_EXCLUDE_FILE

The name of the file which contains default exclude directories for the autoload generator.

UNDEFINED_TOKEN

Undefined token value

Methods

__construct(ezpAutoloadGeneratorOptions $options = null)

Constructs class to generate autoload arrays.

void buildAutoloadArrays()

Searches specified directories for classes, and build autoload arrays.

static array findRecursive(string $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), eZAutoloadGenerator $gen)

Uses the walker in ezcBaseFile to find files.

static void findRecursiveCallback(ezpAutoloadFileFindContext $context, $sourceDir, $fileName, $fileInfo)

Callback used ezcBaseFile

void setMode(int $modeValue)

Convenience method to set the mode directly.

void setOutputCallback(callback $callback)

Sets callback for outputting messages.

array getMessages()

Get the array of logged messaages

array getWarnings()

Get the array of logged warnings

mixed printAutoloadArray(string $printForMode = null)

Prints out the generated autoload arrays.

setOptions($options)

void setOutputObject(object $outputObject)

Sets the object to handle out from the autoload generation.

Details

at line 155
public __construct(ezpAutoloadGeneratorOptions $options = null)

Constructs class to generate autoload arrays.

Parameters

ezpAutoloadGeneratorOptions $options

at line 185
public void buildAutoloadArrays()

Searches specified directories for classes, and build autoload arrays.

Return Value

void

Exceptions

Exception if desired output directory is not a directory, or if the autoload arrays are not writeable by the script.

at line 413
static public array findRecursive(string $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), eZAutoloadGenerator $gen)

Uses the walker in ezcBaseFile to find files.

This also uses the callback to get progress information about the file search.

Parameters

string $sourceDir
array $includeFilters
array $excludeFilters
eZAutoloadGenerator $gen

Return Value

array

at line 554
static public void findRecursiveCallback(ezpAutoloadFileFindContext $context, $sourceDir, $fileName, $fileInfo)

Callback used ezcBaseFile

Parameters

ezpAutoloadFileFindContext $context
$sourceDir
$fileName
$fileInfo

Return Value

void

at line 836
public void setMode(int $modeValue)

Convenience method to set the mode directly.

This is a method which allow you to set the operation mode directly and bypass the options object. The bitmask $modeValue can be set using the MODE_* class constants.

$gen = new eZAutoloadGenerator(); $gen->setMode( eZAutoloadGenerator::MODEEXTENSION | eZAutoloadGenerator::MODETESTS );

Parameters

int $modeValue

Return Value

void

at line 1131
public void setOutputCallback(callback $callback)

Sets callback for outputting messages.

Parameters

callback $callback

Return Value

void

at line 1162
public array getMessages()

Get the array of logged messaages

Return Value

array

at line 1172
public array getWarnings()

Get the array of logged warnings

Return Value

array

at line 1187
public mixed printAutoloadArray(string $printForMode = null)

Prints out the generated autoload arrays.

Meant to provide a user-viewable output of the defined autoload arrays. If $printForMode is provided, only the array for that mode will be printed.

Parameters

string $printForMode Run mode specified by the MODE_* constants.

Return Value

mixed

at line 1204
public setOptions($options)

Parameters

$options

at line 1321
public void setOutputObject(object $outputObject)

Sets the object to handle out from the autoload generation.

Currently this is only handled for the CLI.

Parameters

object $outputObject

Return Value

void

See also

ezpAutoloadCliOutput