Refactoring the package class.

This commit is contained in:
Taylor Otwell 2011-08-08 09:21:56 -05:00
parent 8a6b85175e
commit aba4eec83d
1 changed files with 12 additions and 7 deletions

View File

@ -19,16 +19,21 @@ public static function load($packages)
{
foreach ((array) $packages as $package)
{
// Packages may have a bootstrap file, which commonly is used to register auto-loaders
// and perform other initialization needed to use the package. If the package has a
// bootstrapper, we will require it here.
if ( ! array_key_exists($package, static::$loaded) and file_exists($path = PACKAGE_PATH.$package.'/bootstrap'.EXT))
{
require $path;
}
if (file_exists($bootstrap = PACKAGE_PATH.$package.'/bootstrap'.EXT)) require_once $bootstrap;
static::$loaded[] = $package;
}
}
/**
* Determine if a given package has been loaded.
*
* @param string $package
* @return bool
*/
public static function loaded($package)
{
return array_key_exists($package, static::$loaded);
}
}