PHP Class FOF30\Autoloader\Autoloader

Mostra file Open project: akeeba/fof Class Usage Examples

Public Methods

Method Description
addMap ( string $prefix, array | string $paths, boolean $prepend = false ) Registers a set of PSR-4 directories for a given namespace, either appending or prefixing to the ones previously set for this namespace.
findFile ( string $class ) : string | false Finds the path to the file where the class is defined.
getFallbackDirs ( ) : array Returns the list of fall=back directories
getInstance ( ) : Autoloader
getPrefixes ( ) : array Returns the prefix to directory map
hasMap ( string $prefix ) : boolean Does the autoloader have a map for the specified prefix?
loadClass ( string $class ) : boolean | null Loads the given class or interface.
register ( boolean $prepend = false ) : void Registers this instance as an autoloader.
setMap ( string $prefix, array | string $paths ) : void Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.
unregister ( ) : void Unregisters this instance as an autoloader.

Method Details

addMap() public method

Registers a set of PSR-4 directories for a given namespace, either appending or prefixing to the ones previously set for this namespace.
public addMap ( string $prefix, array | string $paths, boolean $prepend = false )
$prefix string The prefix/namespace, with trailing '\\'
$paths array | string The PSR-0 base directories
$prepend boolean Whether to prefix the directories

findFile() public method

Finds the path to the file where the class is defined.
public findFile ( string $class ) : string | false
$class string The name of the class
return string | false The path if found, false otherwise

getFallbackDirs() public method

Returns the list of fall=back directories
public getFallbackDirs ( ) : array
return array

getInstance() public static method

public static getInstance ( ) : Autoloader
return Autoloader

getPrefixes() public method

Returns the prefix to directory map
public getPrefixes ( ) : array
return array

hasMap() public method

Does the autoloader have a map for the specified prefix?
public hasMap ( string $prefix ) : boolean
$prefix string
return boolean

loadClass() public method

Loads the given class or interface.
public loadClass ( string $class ) : boolean | null
$class string The name of the class
return boolean | null True if loaded, null otherwise

register() public method

Registers this instance as an autoloader.
public register ( boolean $prepend = false ) : void
$prepend boolean Whether to prepend the autoloader or not
return void

setMap() public method

Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.
public setMap ( string $prefix, array | string $paths ) : void
$prefix string The prefix/namespace, with trailing '\\'
$paths array | string The PSR-4 base directories
return void

unregister() public method

Unregisters this instance as an autoloader.
public unregister ( ) : void
return void