final class Autoloader extends Singleton

Autoloader class for managing multiple SPL autoload directories

Properties

static protected Singleton[] $_instances from  Singleton
static protected array $class_map
static protected array $scanned_modules

Methods

__construct()

Protected constructor to prevent more than one instance of autoload directories from being created

static Singleton
instance(mixed $args = null)

Maybe initialize singleton instance and return the instance.

static array
get_instances()

Return a copy of the instances array.

get_class_reflection()

A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.

static 
register_spl_autoload_function()

An alias function for linking our class search function to the SPL autoload list.

bool
add_module_directory(string $directory, array $includable_directories)

Read a module directory and cache class file locations.

static 
search_for_class_file(string $search_class)

Search for a class file via the cached class map.

Details

at line 41
final protected __construct()

Protected constructor to prevent more than one instance of autoload directories from being created

in Singleton at line 42
final static Singleton instance(mixed $args = null)

Maybe initialize singleton instance and return the instance.

Parameters

mixed $args

The arguments to pass to the singleton constructor if constructing.

Return Value

Singleton

This instance.

in Singleton at line 63
final static array get_instances()

Return a copy of the instances array.

Return Value

array

A list of Singleton instances that have been instantiated.

in Singleton at line 72
final protected ReflectionClass get_class_reflection()

A short one-liner tool to get a ReflectionClass so we can get runtime info for the static class instance and not this abstract.

Return Value

ReflectionClass

The runtime instance of this class being evalutated.

at line 54
static protected register_spl_autoload_function()

An alias function for linking our class search function to the SPL autoload list.

at line 66
bool add_module_directory(string $directory, array $includable_directories)

Read a module directory and cache class file locations.

Parameters

string $directory

The module directory to scan.

array $includable_directories

A list of includable directories under /includes/.

Return Value

bool

Whether or not the directory was scanned.

at line 117
static search_for_class_file(string $search_class)

Search for a class file via the cached class map.

Parameters

string $search_class

The class name to search for.