PHP Class Pop\Loader\Autoloader

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$classmap array Class map array.
$fallback boolean Flag to make the autoloader the fallback autoloader or not
$prefixes array Array of available namespaces prefixes.
$suppress boolean Flag to suppress warnings

Public Methods

Method Description
__construct ( boolean $self = true ) : Autoloader Constructor
__invoke ( string $class ) : void Invoke the class
factory ( boolean $self = true ) : Autoloader Static method to instantiate the autoloader object
loadClassMap ( string $classmap ) : Autoloader Load a class map file
register ( string $namespace, string $directory ) : Autoloader Register a namespace and directory location with the autoloader
splAutoloadRegister ( boolean $suppress = true, boolean $fallback = false ) : Autoloader Register the autoloader instance with the SPL

Method Details

__construct() public method

Instantiate the archive object
public __construct ( boolean $self = true ) : Autoloader
$self boolean
return Autoloader

__invoke() public method

Credit to Andreas Schipplock for helping to improve this method: https://github.com/schipplock
public __invoke ( string $class ) : void
$class string
return void

factory() public static method

Static method to instantiate the autoloader object
public static factory ( boolean $self = true ) : Autoloader
$self boolean
return Autoloader

loadClassMap() public method

Load a class map file
public loadClassMap ( string $classmap ) : Autoloader
$classmap string
return Autoloader

register() public method

Register a namespace and directory location with the autoloader
public register ( string $namespace, string $directory ) : Autoloader
$namespace string
$directory string
return Autoloader

splAutoloadRegister() public method

Register the autoloader instance with the SPL
public splAutoloadRegister ( boolean $suppress = true, boolean $fallback = false ) : Autoloader
$suppress boolean
$fallback boolean
return Autoloader

Property Details

$classmap protected property

Class map array.
protected array $classmap
return array

$fallback protected property

Flag to make the autoloader the fallback autoloader or not
protected bool $fallback
return boolean

$prefixes protected property

Array of available namespaces prefixes.
protected array $prefixes
return array

$suppress protected property

Flag to suppress warnings
protected bool $suppress
return boolean