Class-map autoloader

Utilizes class-map files to lookup classfile locations.

package Default

 Methods

Constructor

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

Create a new instance, and optionally configure the autoloader.

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

Parameters

$options

nullarray\Traversable

Autoload a class

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

Parameters

$class

Retrieve current autoload map

getAutoloadMap() : array

Returns

array

Resolve the real_path() to a file within a phar.

realPharPath(string $path) : string
Static
see

Parameters

$path

string

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()

Register an autoload map

registerAutoloadMap(string|array $map) : \Zend\Loader\ClassMapAutoloader

An autoload map may be either an associative array, or a file returning an associative array.

An autoload map should be an associative array containing classname/file pairs.

Parameters

$map

stringarray

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

\Zend\Loader\ClassMapAutoloader

Register many autoload maps at once

registerAutoloadMaps(array $locations) : \Zend\Loader\ClassMapAutoloader

Parameters

$locations

array

Exceptions

\Zend\Loader\Exception\InvalidArgumentException

Returns

\Zend\Loader\ClassMapAutoloader

Configure the autoloader

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

Proxies to \registerAutoloadMaps().

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

Parameters

$options

array\Traversable

Returns

\Zend\Loader\ClassMapAutoloader

Load a map from a file

loadMapFromFile(string $location) : \Zend\Loader\ClassMapAutoloader | mixed

If the map has been previously loaded, returns the current instance; otherwise, returns whatever was returned by calling include() on the location.

Parameters

$location

string

Exceptions

\Zend\Loader\Exception\InvalidArgumentException for nonexistent locations

Returns

\Zend\Loader\ClassMapAutoloadermixed

 Properties

 

Class name/filename map

$map : array

Default

array()
 

Registry of map files that have already been loaded

$mapsLoaded : array

Default

array()