Stud.IP  jlu_3.3 Revision
StudipAutoloader Class Reference
Collaboration diagram for StudipAutoloader:
Collaboration graph

Static Public Member Functions

static register ()
 
static unregister ()
 
static addAutoloadPath ($path, $prefix='')
 
static removeAutoloadPath ($path, $prefix='')
 
static loadClass ($class)
 

Static Protected Attributes

static $autoload_paths = array()
 

Detailed Description

The StudipAutoloader takes care for automatically loading classes. You just have to provide it with a couple of paths where it may find the classes.

Example:

// Add namespace prefix that indicates that class with the given
// namespace will be found in the given directory
StudipAutoloader::addAutoloadPath("[...]lib/classes", "Studip");
static register()
Definition: StudipAutoloader.php:39
static addAutoloadPath($path, $prefix='')
Definition: StudipAutoloader.php:64

Member Function Documentation

◆ addAutoloadPath()

static addAutoloadPath (   $path,
  $prefix = '' 
)
static

Adds another path to the list of paths where to search for classes. You may also pass an optional namespace prefix that indicates that class that start with this prefix are found in the given path.

Parameters
string$paththe path to add
string$prefixthe optional namespace prefix

◆ loadClass()

static loadClass (   $class)
static

Loads the specified class or interface.

Parameters
string$classthe name of the class
Returns
bool|null true, if loaded, otherwise null

◆ register()

static register ( )
static

Registers the StudipAutoloader as an autoloader.

◆ removeAutoloadPath()

static removeAutoloadPath (   $path,
  $prefix = '' 
)
static

Removes a path from the list of paths.

Parameters
string$paththe path to remove
string$prefixthe optional namespace prefix

◆ unregister()

static unregister ( )
static

Un-registers the StudipAutoloader again.

Field Documentation

◆ $autoload_paths

$autoload_paths = array()
staticprotected

The documentation for this class was generated from the following file: