AutoloaderFactory
in package
Table of Contents
Constants
- STANDARD_AUTOLOADER = \Laminas\Loader\StandardAutoloader::class
Properties
- $loaders : array<string|int, mixed>
- $standardAutoloader : StandardAutoloader
Methods
- factory() : void
- Factory for autoloaders
- getRegisteredAutoloader() : SplAutoloader
- Retrieves an autoloader by class name
- getRegisteredAutoloaders() : array<string|int, mixed>
- Get a list of all autoloaders registered with the factory
- unregisterAutoloader() : bool
- Unregister a single autoloader by class name
- unregisterAutoloaders() : void
- Unregisters all autoloaders that have been registered via the factory.
- getStandardAutoloader() : SplAutoloader
- Get an instance of the standard autoloader
- isSubclassOf() : bool
- Checks if the object has this class as one of its parents
Constants
STANDARD_AUTOLOADER
public
mixed
STANDARD_AUTOLOADER
= \Laminas\Loader\StandardAutoloader::class
Properties
$loaders
protected
static array<string|int, mixed>
$loaders
= []
All autoloaders registered using the factory
$standardAutoloader
protected
static StandardAutoloader
$standardAutoloader
StandardAutoloader instance for resolving autoloader classes via the include_path
Methods
factory()
Factory for autoloaders
public
static factory([array<string|int, mixed>|Traversable $options = null ]) : void
Options should be an array or Traversable object of the following structure:
array(
'
The factory will then loop through and instantiate each autoloader with the specified options, and register each with the spl_autoloader.
You may retrieve the concrete autoloader instances later using .
Note that the class names must be resolvable on the include_path or via the Laminas library, using PSR-0 rules (unless the class has already been loaded).
Parameters
- $options : array<string|int, mixed>|Traversable = null
-
(optional) options to use. Defaults to Laminas\Loader\StandardAutoloader
Tags
getRegisteredAutoloader()
Retrieves an autoloader by class name
public
static getRegisteredAutoloader(string $class) : SplAutoloader
Parameters
- $class : string
Tags
Return values
SplAutoloadergetRegisteredAutoloaders()
Get a list of all autoloaders registered with the factory
public
static getRegisteredAutoloaders() : array<string|int, mixed>
Returns an array of autoloader instances.
Return values
array<string|int, mixed>unregisterAutoloader()
Unregister a single autoloader by class name
public
static unregisterAutoloader(string $autoloaderClass) : bool
Parameters
- $autoloaderClass : string
Return values
boolunregisterAutoloaders()
Unregisters all autoloaders that have been registered via the factory.
public
static unregisterAutoloaders() : void
This will NOT unregister autoloaders registered outside of the fctory.
getStandardAutoloader()
Get an instance of the standard autoloader
protected
static getStandardAutoloader() : SplAutoloader
Used to attempt to resolve autoloader classes, using the StandardAutoloader. The instance is marked as a fallback autoloader, to allow resolving autoloaders not under the "Laminas" namespace.
Return values
SplAutoloaderisSubclassOf()
Checks if the object has this class as one of its parents
protected
static isSubclassOf(string $className, string $type) : bool
Parameters
- $className : string
- $type : string