Documentation

rex_autoload
in package

REDAXO Autoloader.

This class was originally copied from the Symfony Framework: Fabien Potencier fabien.potencier@symfony-project.com

Adjusted in very many places

Table of Contents

Properties

$addedDirs  : array<int, string>
$cacheChanged  : bool
$cacheDeleted  : bool
$cacheFile  : string|null
$classes  : array<string, string>
$composerLoader  : ClassLoader
$dirs  : array<string, array<string, string>>
$registered  : bool
$reloaded  : bool

Methods

addDirectory()  : void
Adds a directory to the autoloading system if not yet present.
autoload()  : bool
Handles autoloading of classes.
getClasses()  : array<int, string>
Returns the classes.
register()  : void
Register rex_autoload in spl autoloader.
reload()  : void
Reanalyses all added directories.
removeCache()  : void
Removes the cache.
saveCache()  : void
Saves the cache.
unregister()  : void
Unregister rex_autoload from spl autoloader.

Properties

$addedDirs

protected static array<int, string> $addedDirs = []

$cacheChanged

protected static bool $cacheChanged = \false

$cacheDeleted

protected static bool $cacheDeleted = \false

remember the cache was deleted, to make sure we don't generate a stale cache file

$cacheFile

protected static string|null $cacheFile

$classes

protected static array<string, string> $classes = []

$composerLoader

protected static ClassLoader $composerLoader

$dirs

protected static array<string, array<string, string>> $dirs = []

$registered

protected static bool $registered = \false

$reloaded

protected static bool $reloaded = \false

Methods

addDirectory()

Adds a directory to the autoloading system if not yet present.

public static addDirectory(string $dir) : void
Parameters
$dir : string

The directory to look for classes

autoload()

Handles autoloading of classes.

public static autoload(string $class) : bool
Parameters
$class : string

A class name

Return values
bool

Returns true if the class has been loaded

getClasses()

Returns the classes.

public static getClasses() : array<int, string>
Return values
array<int, string>

register()

Register rex_autoload in spl autoloader.

public static register() : void

reload()

Reanalyses all added directories.

public static reload([bool $force = false ]) : void
Parameters
$force : bool = false

If true, all files are reanalysed, otherwise only new and changed files

removeCache()

Removes the cache.

public static removeCache() : void

saveCache()

Saves the cache.

public static saveCache() : void

unregister()

Unregister rex_autoload from spl autoloader.

public static unregister() : void

        
On this page

Search results