added routed array.

This commit is contained in:
Taylor Otwell 2012-02-06 16:54:44 -06:00
parent a4acb1c0fb
commit 78dc4529f1
1 changed files with 23 additions and 1 deletions

View File

@ -23,6 +23,13 @@ class Bundle {
*/ */
public static $started = array(); public static $started = array();
/**
* All of the bundles that have their routes files loaded.
*
* @var array
*/
public static $routed = array();
/** /**
* Register a bundle for the application. * Register a bundle for the application.
* *
@ -107,10 +114,14 @@ public static function start($bundle)
*/ */
public static function routes($bundle) public static function routes($bundle)
{ {
if (file_exists($path = static::path($bundle).'routes'.EXT)) $path = static::path($bundle).'routes'.EXT;
if ( ! static::routed($bundle) and file_exists($path))
{ {
require $path; require $path;
} }
static::$routed[] = $bundle;
} }
/** /**
@ -155,6 +166,17 @@ public static function started($bundle)
return in_array(strtolower($bundle), static::$started); return in_array(strtolower($bundle), static::$started);
} }
/**
* Determine if a given bundle has its routes file loaded.
*
* @param string $bundle
* @return void
*/
public static function routed($bundle)
{
return in_array(strtolower($bundle), static::$routed);
}
/** /**
* Get the identifier prefix for the bundle. * Get the identifier prefix for the bundle.
* *