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<string|int, string>
$cacheChanged  : bool
$cacheDeleted  : bool
$cacheFile  : string|null
$classes  : array<string|int, string>
$composerLoader  : ClassLoader
$dirs  : array<string|int, array<string|int, 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<string|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<string|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|int, string> $classes = []

$composerLoader

protected static ClassLoader $composerLoader

$dirs

protected static array<string|int, array<string|int, 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<string|int, string>
Return values
array<string|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