\Anax\LoaderCPsr4Autoloader

Summary

Methods
Properties
Constants
register()
addNamespace()
loadClass()
No public properties found
No constants found
loadMappedFile()
requireFile()
$prefixes
N/A
No private methods found
No private properties found
N/A

Properties

$prefixes

$prefixes : array

An associative array where the key is a namespace prefix and the value is an array of base directories for classes in that namespace.

Type

array

Methods

register()

register() : $this

Register loader with SPL autoloader stack.

Returns

$this

addNamespace()

addNamespace(string  $prefix, string  $base_dir, boolean  $prepend = false) : $this

Adds a base directory for a namespace prefix.

Parameters

string $prefix

The namespace prefix.

string $base_dir

A base directory for class files in the namespace.

boolean $prepend

If true, prepend the base directory to the stack instead of appending it; this causes it to be searched first rather than last.

Returns

$this

loadClass()

loadClass(string  $class) : mixed

Loads the class file for a given class name.

Parameters

string $class

The fully-qualified class name.

Returns

mixed —

The mapped file name on success, or boolean false on failure.

loadMappedFile()

loadMappedFile(string  $prefix, string  $relative_class) : mixed

Load the mapped file for a namespace prefix and relative class.

Parameters

string $prefix

The namespace prefix.

string $relative_class

The relative class name.

Returns

mixed —

Boolean false if no mapped file can be loaded, or the name of the mapped file that was loaded.

requireFile()

requireFile(string  $file) : boolean

If a file exists, require it from the file system.

Parameters

string $file

The file to require.

Returns

boolean —

True if the file exists, false if not.