MapClassLoader
in package
A class loader that uses a mapping file to look up paths.
Tags
Table of Contents
- $map : mixed
- __construct() : mixed
- findFile() : string|null
- Finds the path to the file where the class is defined.
- loadClass() : mixed
- Loads the given class or interface.
- register() : mixed
- Registers this instance as an autoloader.
Properties
$map
private
mixed
$map
= []
Methods
__construct()
public
__construct(array<string|int, mixed> $map) : mixed
Parameters
- $map : array<string|int, mixed>
-
A map where keys are classes and values the absolute file path
Return values
mixed —findFile()
Finds the path to the file where the class is defined.
public
findFile(string $class) : string|null
Parameters
- $class : string
-
The name of the class
Return values
string|null —The path, if found
loadClass()
Loads the given class or interface.
public
loadClass(string $class) : mixed
Parameters
- $class : string
-
The name of the class
Return values
mixed —register()
Registers this instance as an autoloader.
public
register([bool $prepend = false ]) : mixed
Parameters
- $prepend : bool = false
-
Whether to prepend the autoloader or not