Class-map autoloader

Utilizes class-map files to lookup classfile locations.

category Zend
package Zend_Loader

 Methods

Constructor

__construct(null | array | \Traversable $options) 

Create a new instance, and optionally configure the autoloader.

Parameters

$options

nullarray\Traversable

Autoload a class

autoload($class) : mixed

Parameters

$class

Returns

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

Retrieve current autoload map

getAutoloadMap() : array

Returns

array

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

realPharPath(string $path) : string

see \Zend\Loader\https://bugs.php.net/bug.php?id=52769

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'));

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

Register many autoload maps at once

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

Configure the autoloader

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

Proxies to registerAutoloadMaps().

Parameters

$options

array\Traversable

Returns

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

 Properties

 

Class name/filename map

$map : array

 

Registry of map files that have already been loaded

$mapsLoaded : array