You are here

function xautoload in X Autoload 7.3

Same name and namespace in other branches
  1. 7.5 xautoload.early.lib.inc \xautoload()
  2. 7.2 xautoload.module \xautoload()
  3. 7.4 xautoload.early.lib.inc \xautoload()

Get a service object from the registry. Services are lazy-created first time you need them.

Parameters

string $key: Identifier of the service within the registry. The xautoload_ServiceFactory should have a method with the same name.

Return value

xautoload_Container_LazyServices|mixed

1 call to xautoload()
xautoload_get_finder in ./xautoload.early.inc
Get the class finder object. This is the public version of _xautoload_finder().
4 string references to 'xautoload'
XAutoloadWebTestCase::xautoloadCheckCacheMode in lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php
xautoload_BootSchedule_Default::initMainPhase in lib/BootSchedule/Default.php
Init the phase where all *.module files are loaded, and run hook_xautoload() on all modules that implement it.
_MYMODULE_include in ./xautoload.emulate.inc
Register a dedicated class loader only for this module.
_xautoload_register in ./xautoload.early.inc
Create and register the xautoload class loader. Register the xautoload prefix, but don't register any Drupal-specific stuff yet.

File

./xautoload.early.inc, line 41

Code

function xautoload($key = 'main') {
  static $service_registry;
  if (!isset($service_registry)) {
    $service_factory = new xautoload_ServiceFactory();
    $service_registry = new xautoload_Container_LazyServices($service_factory);
  }
  return isset($key) ? $service_registry
    ->get($key) : $service_registry;
}