improve bundle configuration and registration.

This commit is contained in:
Taylor Otwell
2012-01-26 20:07:02 -06:00
parent 300ab50a84
commit 70082508f5
4 changed files with 20 additions and 5 deletions

View File

@@ -35,14 +35,22 @@ class Bundle {
{
$defaults = array('handles' => null, 'auto' => false);
// If the given config is actually a string, we will assume it is a location
// and convert it to an array so that the developer may conveniently add
// bundles to the configuration without making an array for each one.
if (is_string($config))
{
$config = array('location' => $config);
}
if ( ! isset($config['location']))
{
throw new \Exception("Location not set for bundle [$bundle]");
}
// We will trim the trailing slash from the location and add it back so we don't
// have to worry about the developer adding or not adding it to the location
// path for the bundle. This makes sure it is always there.
// We will trim the trailing slash from the location and add it back so
// we don't have to worry about the developer adding or not adding it
// to the location path for the bundle.
$config['location'] = BUNDLE_PATH.rtrim($config['location'], DS).DS;
static::$bundles[$bundle] = array_merge($defaults, $config);