function xautoload in X Autoload 7.5
Same name and namespace in other branches
- 7.2 xautoload.module \xautoload()
- 7.3 xautoload.early.inc \xautoload()
- 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. The recommended way (esp if you ask your IDE) is to omit this parameter and use xautoload()->$key instead.
Return value
Main|object
15 string references to 'xautoload'
- AbstractDrupalBootTest::prepareAllEnabled in tests/
src/ DrupalBootTest/ AbstractDrupalBootTest.php - Start with all available modules enabled.
- AbstractDrupalBootTest::prepareInitialModules in tests/
src/ DrupalBootTest/ AbstractDrupalBootTest.php - AbstractExampleModules::getExtensionFilename in tests/
src/ Example/ AbstractExampleModules.php - DrupalBootTest::initialModulesVariations in tests/
src/ DrupalBootTest/ DrupalBootTest.php - DrupalPhaseControl::checkNewExtensions in src/
Phases/ DrupalPhaseControl.php - Checks if new extensions have been enabled, and registers them.
File
- ./
xautoload.early.lib.inc, line 45
Code
function xautoload($key = 'main') {
static $service_registry;
static $main;
if (!isset($service_registry)) {
$service_factory = new ServiceFactory();
$service_registry = new ServiceContainer($service_factory);
$main = $service_registry->main;
}
switch ($key) {
case 'main':
return $main;
default:
// Legacy..
return $service_registry
->get($key);
}
}