From aba4eec83ddea72429063ba4a29f526ecc73b587 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Aug 2011 09:21:56 -0500 Subject: [PATCH] Refactoring the package class. --- system/package.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/system/package.php b/system/package.php index 5adb64ec..9b8721bf 100644 --- a/system/package.php +++ b/system/package.php @@ -19,16 +19,21 @@ class Package { { 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); + } + } \ No newline at end of file