Skip to content

Commit

Permalink
Initial commit of new Composer-based class loading interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Sep 18, 2012
1 parent d42184c commit ec39c7b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -18,5 +18,8 @@
"require": {
"php": ">=5.3.6",
"composer/installers": "dev-master"
},
"autoload": {
"psr-0": {"lithium\\": "/" }
}
}
21 changes: 21 additions & 0 deletions core/Libraries.php
Expand Up @@ -71,6 +71,13 @@ class Libraries {
*/
protected static $_configurations = array();

/**
* A Composer-compatible SPL autoloader implementation.
*
* @var object
*/
protected static $_loader = null;

/**
* Contains a cascading list of search path templates, indexed by base object type.
*
Expand Down Expand Up @@ -336,6 +343,20 @@ protected static function _configure($config) {
}
}

/**
* Configures dependency libraries using Composer's generated autoloader to introspect
* dependencies.
*
* @param string $file A Composer-generated autoload file, which returns a PSR-0-compatible
* autloader instance.
*/
public static function loadConfig($file) {
if (static::$_loader) {
throw new ConfigException("Class loader already configured.");
}
static::$_loader = require $file;
}

/**
* Allows library information to be retrieved in various ways, including:
*
Expand Down

0 comments on commit ec39c7b

Please sign in to comment.