Documentation

Autoloader
in package

Class Hoa\Consistency\Autoloader.

This class is a PSR-4 compliant autoloader.

Tags
copyright

Copyright © 2007-2017 Hoa community

license

New BSD License

Table of Contents

Properties

$_namespacePrefixesToBaseDirectories  : array<string|int, mixed>
Namespace prefixes to base directories.

Methods

addNamespace()  : void
Add a base directory for a namespace prefix.
dnew()  : object
Dynamic new, a simple factory.
getBaseDirectories()  : array<string|int, mixed>
Get declared base directories for a namespace prefix.
getLoadedClasses()  : array<string|int, mixed>
Get loaded classes.
getRegisteredAutoloaders()  : array<string|int, mixed>
Get all registered autoloaders (not only from this library).
hasBaseDirectory()  : bool
Check whether at least one base directory exists for a namespace prefix.
load()  : bool
Try to load the entity file for a given entity name.
register()  : bool
Register the autoloader.
requireFile()  : bool
Require a file if exists.
runAutoloaderStack()  : void
Run the entire autoloader stack with a specific entity.
unregister()  : bool
Unregister the autoloader.

Properties

$_namespacePrefixesToBaseDirectories

Namespace prefixes to base directories.

protected array<string|int, mixed> $_namespacePrefixesToBaseDirectories = []

Methods

addNamespace()

Add a base directory for a namespace prefix.

public addNamespace(string $prefix, string $baseDirectory[, bool $prepend = false ]) : void
Parameters
$prefix : string

Namespace prefix.

$baseDirectory : string

Base directory for this prefix.

$prepend : bool = false

Whether the prefix is prepended or appended to the prefix' stack.

dnew()

Dynamic new, a simple factory.

public static dnew(bool $classname[, array<string|int, mixed> $arguments = [] ]) : object

It loads and constructs a class, with provided arguments.

Parameters
$classname : bool

Classname.

$arguments : array<string|int, mixed> = []

Arguments for the constructor.

Return values
object

getBaseDirectories()

Get declared base directories for a namespace prefix.

public getBaseDirectories(string $namespacePrefix) : array<string|int, mixed>
Parameters
$namespacePrefix : string

Namespace prefix.

Return values
array<string|int, mixed>

getLoadedClasses()

Get loaded classes.

public static getLoadedClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRegisteredAutoloaders()

Get all registered autoloaders (not only from this library).

public getRegisteredAutoloaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasBaseDirectory()

Check whether at least one base directory exists for a namespace prefix.

public hasBaseDirectory(string $namespacePrefix) : bool
Parameters
$namespacePrefix : string

Namespace prefix.

Return values
bool

load()

Try to load the entity file for a given entity name.

public load(string $entity) : bool
Parameters
$entity : string

Entity name to load.

Return values
bool

register()

Register the autoloader.

public register([bool $prepend = false ]) : bool
Parameters
$prepend : bool = false

Prepend this autoloader to the stack or not.

Return values
bool

requireFile()

Require a file if exists.

public requireFile(string $filename) : bool
Parameters
$filename : string

File name.

Return values
bool

runAutoloaderStack()

Run the entire autoloader stack with a specific entity.

public runAutoloaderStack(string $entity) : void
Parameters
$entity : string

Entity name to load.

unregister()

Unregister the autoloader.

public unregister() : bool
Return values
bool

        
On this page

Search results