Zend Framework  3.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ModuleAutoloader Class Reference

Public Member Functions

 __construct ($options=null)
 Constructor.
 
 setOptions ($options)
 Configure the autoloader.
 
 getModuleClassMap ()
 Retrieves the class map for all loaded modules.
 
 setModuleClassMap (array $classmap)
 Sets the class map used to speed up the module autoloading.
 
 autoload ($class)
 Autoload a class.
 
 register ()
 Register the autoloader with spl_autoload registry.
 
 unregister ()
 Unregister the autoloader with spl_autoload registry.
 
 registerPaths ($paths)
 registerPaths
 
 registerPath ($path, $moduleName=false)
 registerPath
 
 getPaths ()
 getPaths
 

Static Public Member Functions

static normalizePath ($path, $trailingSlash=true)
 Normalize a path for insertion in the stack.
 

Protected Member Functions

 loadModuleFromDir ($dirPath, $class)
 loadModuleFromDir
 
 loadModuleFromPhar ($pharPath, $class)
 loadModuleFromPhar
 
 pharFileToModuleName ($pharPath)
 Returns the base module name from the path to a phar.
 

Protected Attributes

 $paths = array()
 
 $explicitPaths = array()
 
 $namespacedPaths = array()
 
 $pharBasePath = ""
 
 $pharExtensions = array()
 
 $moduleClassMap = array()
 

Constructor & Destructor Documentation

__construct (   $options = null)

Constructor.

Allow configuration of the autoloader via the constructor.

Parameters
null | array | Traversable$options

Implements SplAutoloader.

Member Function Documentation

autoload (   $class)

Autoload a class.

Parameters
$class
Returns
mixed False [if unable to load $class] get_class($class) [if $class is successfully loaded]

Implements SplAutoloader.

getModuleClassMap ( )

Retrieves the class map for all loaded modules.

Returns
array
getPaths ( )

getPaths

This is primarily for unit testing, but could have other uses.

Returns
array
loadModuleFromDir (   $dirPath,
  $class 
)
protected

loadModuleFromDir

Parameters
string$dirPath
string$class
Returns
mixed False [if unable to load $class] get_class($class) [if $class is successfully loaded]
loadModuleFromPhar (   $pharPath,
  $class 
)
protected

loadModuleFromPhar

Parameters
string$pharPath
string$class
Returns
mixed False [if unable to load $class] get_class($class) [if $class is successfully loaded]
static normalizePath (   $path,
  $trailingSlash = true 
)
static

Normalize a path for insertion in the stack.

Parameters
string$path
bool$trailingSlashWhether trailing slash should be included
Returns
string
pharFileToModuleName (   $pharPath)
protected

Returns the base module name from the path to a phar.

Parameters
string$pharPath
Returns
string
register ( )

Register the autoloader with spl_autoload registry.

Returns
void

Implements SplAutoloader.

registerPath (   $path,
  $moduleName = false 
)

registerPath

Parameters
string$path
bool | string$moduleName
Exceptions
\InvalidArgumentException
Returns
ModuleAutoloader
registerPaths (   $paths)

registerPaths

Parameters
array | Traversable$paths
Exceptions
\InvalidArgumentException
Returns
ModuleAutoloader
setModuleClassMap ( array  $classmap)

Sets the class map used to speed up the module autoloading.

Parameters
array$classmap
Returns
ModuleAutoloader
setOptions (   $options)

Configure the autoloader.

In most cases, $options should be either an associative array or Traversable object.

Parameters
array | Traversable$options
Returns
ModuleAutoloader

Implements SplAutoloader.

unregister ( )

Unregister the autoloader with spl_autoload registry.

Returns
void

Member Data Documentation

$explicitPaths = array()
protected
$moduleClassMap = array()
protected
$namespacedPaths = array()
protected
$paths = array()
protected
$pharBasePath = ""
protected
$pharExtensions = array()
protected