package Default

 Methods

Constructor

__construct(null|array|\Traversable $options = null

Allow configuration of the autoloader via the constructor.

inherited_from \Zend\Loader\SplAutoloader::__construct()

Parameters

$options

nullarray\Traversable

Autoload a class

autoload($class) : mixed
inherited_from \Zend\Loader\SplAutoloader::autoload()

Parameters

$class

Returns

mixedFalse [if unable to load $class] get_class($class) [if $class is successfully loaded]

Retrieves the class map for all loaded modules.

getModuleClassMap() : array

Returns

array

getPaths

getPaths() : array

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

Returns

array

Normalize a path for insertion in the stack

normalizePath(string $path, boolean $trailingSlash = true) : string
Static

Parameters

$path

string

$trailingSlash

boolean

Whether trailing slash should be included

Returns

string

Register the autoloader with spl_autoload registry

register() : void

Typically, the body of this will simply be: spl_autoload_register(array($this, 'autoload'));

inherited_from \Zend\Loader\SplAutoloader::register()

registerPath

registerPath(string $path, boolean|string $moduleName = false) : \Zend\Loader\ModuleAutoloader

Parameters

$path

string

$moduleName

booleanstring

Exceptions

\InvalidArgumentException

Returns

\Zend\Loader\ModuleAutoloader

registerPaths

registerPaths(array|\Traversable $paths) : \Zend\Loader\ModuleAutoloader

Parameters

$paths

array\Traversable

Exceptions

\InvalidArgumentException

Returns

\Zend\Loader\ModuleAutoloader

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

setModuleClassMap(array $classmap) : \Zend\Loader\ModuleAutoloader

Parameters

$classmap

array

Returns

\Zend\Loader\ModuleAutoloader

Configure the autoloader

setOptions(array|\Traversable $options) : \Zend\Loader\ModuleAutoloader

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

inherited_from \Zend\Loader\SplAutoloader::setOptions()

Parameters

$options

array\Traversable

Returns

\Zend\Loader\ModuleAutoloader

Unregister the autoloader with spl_autoload registry

unregister() : void

loadModuleFromDir

loadModuleFromDir(string $dirPath, string $class) : mixed

Parameters

$dirPath

string

$class

string

Returns

mixedFalse [if unable to load $class] get_class($class) [if $class is successfully loaded]

loadModuleFromPhar

loadModuleFromPhar(string $pharPath, string $class) : mixed

Parameters

$pharPath

string

$class

string

Returns

mixedFalse [if unable to load $class] get_class($class) [if $class is successfully loaded]

Returns the base module name from the path to a phar

pharFileToModuleName(string $pharPath) : string

Parameters

$pharPath

string

Returns

string

 Properties

 

An array of modulename => path

$explicitPaths : array

Default

array()
 

An array of module classes to their containing files

$moduleClassMap : array

Default

array()
 

An array of namespaceName => namespacePath

$namespacedPaths : array

Default

array()
 

An array of module paths to scan

$paths : array

Default

array()
 

Will contain the absolute phar:// path to the executable when packaged as phar file

$pharBasePath : string

Default

""
 

An array of supported phar extensions (filled on constructor)

$pharExtensions : array

Default

array()