HumHub Documentation (unofficial)

AutoloaderFactory
in package

AbstractYes

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

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( '' => $autoloaderOptions, )

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
throws
InvalidArgumentException

For invalid options.

throws
InvalidArgumentException

For unloadable autoloader classes.

throws
DomainException

For autoloader classes not implementing SplAutoloader.

getRegisteredAutoloaders()

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
bool

unregisterAutoloaders()

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
SplAutoloader

        
On this page

Search results