Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit of new Composer-based class loading interface.

  • Loading branch information...
commit ec39c7bcf7c7c06b6ce9bc2c83918cbffaefae83 1 parent d42184c
@nateabele nateabele authored
Showing with 24 additions and 0 deletions.
  1. +3 −0  composer.json
  2. +21 −0 core/Libraries.php
View
3  composer.json
@@ -18,5 +18,8 @@
"require": {
"php": ">=5.3.6",
"composer/installers": "dev-master"
+ },
+ "autoload": {
+ "psr-0": {"lithium\\": "/" }
}
}
View
21 core/Libraries.php
@@ -72,6 +72,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.
*
* Used by `Libraries::locate()` to perform service location. This allows new types of
@@ -337,6 +344,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:
*
* By name:
Please sign in to comment.
Something went wrong with that request. Please try again.