|
Bearsampp 2026.3.26
API documentation
|
Public Member Functions | |
| __construct () | |
| load ($class) | |
| register () | |
| unregister () | |
Static Public Member Functions | |
| static | clearCache () |
| static | getCacheSize () |
| static | getStats () |
Private Member Functions | |
| resolveClassPath ($class, $rootPath) | |
Static Private Attributes | |
| static | $classMap = [] |
| static | $failedLookups = [] |
| static | $stats |
Class Autoloader
This class handles the autoloading of classes within the Bearsampp application. It registers itself with the SPL autoload stack and loads classes based on naming conventions.
Performance optimizations:
Definition at line 21 of file class.autoloader.php.
| __construct | ( | ) |
Autoloader constructor.
Initializes the Autoloader object.
Definition at line 50 of file class.autoloader.php.
|
static |
Clears the autoloader cache. Useful for testing or when class files are modified during runtime.
Definition at line 150 of file class.autoloader.php.
|
static |
Gets the size of the class map cache.
Definition at line 166 of file class.autoloader.php.
|
static |
Gets the current cache statistics. Useful for monitoring and debugging cache effectiveness.
Definition at line 139 of file class.autoloader.php.
| load | ( | $class | ) |
Loads the specified class file based on the class name. Implements caching to improve performance on repeated class loads.
| string | $class | The name of the class to load. |
Definition at line 61 of file class.autoloader.php.
References $bearsamppRoot, and resolveClassPath().
| register | ( | ) |
Registers the autoloader with the SPL autoload stack.
Definition at line 176 of file class.autoloader.php.
|
private |
Resolves the file path for a given class name based on naming conventions. Extracted into separate method for better maintainability and testability.
| string | $class | The lowercase class name |
| string | $rootPath | The root path to the classes directory |
Definition at line 106 of file class.autoloader.php.
References Util\startWith().
Referenced by load().
| unregister | ( | ) |
Unregisters the autoloader from the SPL autoload stack.
Definition at line 186 of file class.autoloader.php.
|
staticprivate |
Definition at line 27 of file class.autoloader.php.
|
staticprivate |
Definition at line 33 of file class.autoloader.php.
|
staticprivate |
Definition at line 39 of file class.autoloader.php.