sfSimpleAutoload
in package
sfSimpleAutoload stub for standalone Heratio mode.
Provides the sfSimpleAutoload singleton when Symfony is not installed. Required because sfPluginConfiguration::initializeAutoload() calls sfSimpleAutoload::getInstance() and ->addDirectory() / ->register().
API-compatible with vendor/symfony/lib/autoload/sfSimpleAutoload.class.php. In dual-stack mode (Symfony present), the real sfSimpleAutoload is loaded by sfCoreAutoload and this file is never included.
Unlike the real implementation, this stub does NOT use sfFinder (which is unavailable in standalone mode). Instead, it uses PHP's built-in RecursiveDirectoryIterator for directory scanning.
Table of Contents
Methods
- addDirectory() : mixed
- Adds a directory to the autoloading system.
- addFile() : mixed
- Adds a file to the autoloading system.
- addFiles() : mixed
- Adds files to the autoloading system.
- autoload() : bool
- Handles autoloading of classes.
- getClassPath() : string|null
- Returns the path where a particular class can be found.
- getInstance() : sfSimpleAutoload
- Retrieves the singleton instance.
- loadCache() : mixed
- Loads the cache — no-op in standalone mode.
- loadConfiguration() : mixed
- Loads configuration from the supplied files.
- register() : mixed
- Register sfSimpleAutoload in spl autoloader.
- reload() : mixed
- Reloads the autoloader.
- removeCache() : mixed
- Removes the cache — no-op in standalone mode.
- saveCache() : mixed
- Saves the cache — no-op in standalone mode.
- setClassPath() : mixed
- Sets the path for a particular class.
- unregister() : mixed
- Unregister sfSimpleAutoload from spl autoloader.
Methods
addDirectory()
Adds a directory to the autoloading system.
public
addDirectory(string $dir[, string $ext = '.php' ]) : mixed
Uses RecursiveDirectoryIterator instead of sfFinder (unavailable in standalone mode).
Parameters
- $dir : string
-
The directory to look for classes
- $ext : string = '.php'
-
The extension to look for
addFile()
Adds a file to the autoloading system.
public
addFile(string $file[, bool $register = true ]) : mixed
Parameters
- $file : string
-
A file path
- $register : bool = true
-
Whether to register the file as a single entity
addFiles()
Adds files to the autoloading system.
public
addFiles(array<string|int, mixed> $files[, bool $register = true ]) : mixed
Parameters
- $files : array<string|int, mixed>
-
An array of files
- $register : bool = true
-
Whether to register those files
autoload()
Handles autoloading of classes.
public
autoload(string $class) : bool
Parameters
- $class : string
-
A class name
Return values
bool —Returns true if the class has been loaded
getClassPath()
Returns the path where a particular class can be found.
public
getClassPath(string $class) : string|null
Parameters
- $class : string
-
A PHP class name
Return values
string|null —An absolute path
getInstance()
Retrieves the singleton instance.
public
static getInstance([string|null $cacheFile = null ]) : sfSimpleAutoload
Parameters
- $cacheFile : string|null = null
-
The file path to save the cache (ignored in stub)
Return values
sfSimpleAutoloadloadCache()
Loads the cache — no-op in standalone mode.
public
loadCache() : mixed
loadConfiguration()
Loads configuration from the supplied files.
public
loadConfiguration(array<string|int, mixed> $files) : mixed
No-op in standalone mode — sfAutoloadConfigHandler is unavailable.
Parameters
- $files : array<string|int, mixed>
-
An array of autoload.yml files
register()
Register sfSimpleAutoload in spl autoloader.
public
static register() : mixed
reload()
Reloads the autoloader.
public
reload() : mixed
removeCache()
Removes the cache — no-op in standalone mode.
public
removeCache() : mixed
saveCache()
Saves the cache — no-op in standalone mode.
public
saveCache() : mixed
setClassPath()
Sets the path for a particular class.
public
setClassPath(string $class, string $path) : mixed
Parameters
- $class : string
-
A PHP class name
- $path : string
-
An absolute path
unregister()
Unregister sfSimpleAutoload from spl autoloader.
public
static unregister() : mixed