Refactoring the package class.
This commit is contained in:
parent
8a6b85175e
commit
aba4eec83d
|
@ -19,16 +19,21 @@ public static function load($packages)
|
||||||
{
|
{
|
||||||
foreach ((array) $packages as $package)
|
foreach ((array) $packages as $package)
|
||||||
{
|
{
|
||||||
// Packages may have a bootstrap file, which commonly is used to register auto-loaders
|
if (file_exists($bootstrap = PACKAGE_PATH.$package.'/bootstrap'.EXT)) require_once $bootstrap;
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static::$loaded[] = $package;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue