Abstract Class JLoader

Description

Static class to handle loading of libraries.

  • abstract:
  • since: 11.1

Located in /libraries/loader.php (line 17)


	
			
Variable Summary
 static array $classAliases
 static array $classes
 static array $imported
 static array $namespaces
 static array $prefixes
Method Summary
 static void discover (string $classPrefix, string $parentPath, [boolean $force = true], [boolean $recurse = false])
 static array getClassList ()
 static array getNamespaces ()
 static boolean import (string $key, [string $base = null])
 static boolean load (string $class)
 static boolean loadByAlias (string $class)
 static boolean loadByPsr0 (string $class)
 static void register (string $class, string $path, [boolean $force = true])
 static boolean registerAlias (string $alias, string $original)
 static void registerNamespace (string $namespace, string $path, [boolean $reset = false], [boolean $prepend = false])
 static void registerPrefix (string $prefix, string $path, [boolean $reset = false], [boolean $prepend = false])
 static void setup ([boolean $enablePsr = true], [boolean $enablePrefixes = true], [boolean $enableClasses = true])
Variables
static array $classAliases = array() (line 49)

Holds proxy classes and the class names the proxy.

  • since: 3.2
  • access: protected
static array $classes = array() (line 25)

Container for already imported library paths.

  • since: 11.1
  • access: protected
static array $imported = array() (line 33)

Container for already imported library paths.

  • since: 11.1
  • access: protected
static array $namespaces = array() (line 57)

Container for namespace => path map.

  • since: 12.3
  • access: protected
static array $prefixes = array() (line 41)

Container for registered library class prefixes and path lookups.

  • since: 12.1
  • access: protected
Methods
static discover (line 71)

Method to discover classes of a given type in a given path.

  • since: 11.1
  • access: public
static void discover (string $classPrefix, string $parentPath, [boolean $force = true], [boolean $recurse = false])
  • string $classPrefix: The class name prefix to use for discovery.
  • string $parentPath: Full path to the parent folder for the classes to discover.
  • boolean $force: True to overwrite the autoload path value for the class if it already exists.
  • boolean $recurse: Recurse through all child directories as well as the parent path.
static getClassList (line 119)

Method to get the list of registered classes and their respective file paths for the autoloader.

  • return: The array of class => path values for the autoloader.
  • since: 11.1
  • access: public
static array getClassList ()
static getNamespaces (line 131)

Method to get the list of registered namespaces.

  • return: The array of namespace => path values for the autoloader.
  • since: 12.3
  • access: public
static array getNamespaces ()
static import (line 146)

Loads a class from specified directories.

  • return: True on success.
  • since: 11.1
  • access: public
static boolean import (string $key, [string $base = null])
  • string $key: The class name to look for (dot notation).
  • string $base: Search this directory for the class.
static load (line 211)

Load the file for a class.

  • return: True on success
  • since: 11.1
  • access: public
static boolean load (string $class)
  • string $class: The class to be loaded.
static loadByAlias (line 476)

Method to autoload classes that have been aliased using the registerAlias method.

  • return: True on success, false otherwise.
  • since: 3.2
  • access: public
static boolean loadByAlias (string $class)
  • string $class: The fully qualified class name to autoload.
static loadByPsr0 (line 419)

Method to autoload classes that are namespaced to the PSR-0 standard.

  • return: True on success, false otherwise.
  • since: 13.1
  • access: public
static boolean loadByPsr0 (string $class)
  • string $class: The fully qualified class name to autoload.
static register (line 244)

Directly register a class to the autoload list.

  • since: 11.1
  • access: public
static void register (string $class, string $path, [boolean $force = true])
  • string $class: The class name to register.
  • string $path: Full path to the file that holds the class to register.
  • boolean $force: True to overwrite the autoload path value for the class if it already exists.
static registerAlias (line 316)

Offers the ability for "just in time" usage of `class_alias()`.

You cannot overwrite an existing alias.

  • return: True if registration was successful. False if the alias already exists.
  • since: 3.2
  • access: public
static boolean registerAlias (string $alias, string $original)
  • string $alias: The alias name to register.
  • string $original: The original class to alias.
static registerNamespace (line 342)

Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.

  • since: 12.3
  • throws: RuntimeException
  • access: public
static void registerNamespace (string $namespace, string $path, [boolean $reset = false], [boolean $prepend = false])
  • string $namespace: A case sensitive Namespace to register.
  • string $path: A case sensitive absolute file path to the library root where classes of the given namespace can be found.
  • boolean $reset: True to reset the namespace with only the given lookup path.
  • boolean $prepend: If true, push the path to the beginning of the namespace lookup paths array.
static registerPrefix (line 278)

Register a class prefix with lookup path. This will allow developers to register library

packages with different class prefixes to the system autoloader. More than one lookup path may be registered for the same class prefix, but if this method is called with the reset flag set to true then any registered lookups for the given prefix will be overwritten with the current lookup path. When loaded, prefix paths are searched in a "last in, first out" order.

  • since: 12.1
  • throws: RuntimeException
  • access: public
static void registerPrefix (string $prefix, string $path, [boolean $reset = false], [boolean $prepend = false])
  • string $prefix: The class prefix to register.
  • string $path: Absolute file path to the library root where classes with the given prefix can be found.
  • boolean $reset: True to reset the prefix with only the given lookup path.
  • boolean $prepend: If true, push the path to the beginning of the prefix lookup paths array.
static setup (line 385)

Method to setup the autoloaders for the Joomla Platform.

Since the SPL autoloaders are called in a queue we will add our explicit class-registration based loader first, then fall back on the autoloader based on conventions. This will allow people to register a class in a specific location and override platform libraries as was previously possible.

  • since: 12.3
  • access: public
static void setup ([boolean $enablePsr = true], [boolean $enablePrefixes = true], [boolean $enableClasses = true])
  • boolean $enablePsr: True to enable autoloading based on PSR-0.
  • boolean $enablePrefixes: True to enable prefix based class loading (needed to auto load the Joomla core).
  • boolean $enableClasses: True to enable class map based class loading (needed to auto load the Joomla core).

Documentation generated on Tue, 19 Nov 2013 15:07:23 +0100 by phpDocumentor 1.4.3