Browse Source

added default option to bundle::option method.

Taylor Otwell 12 years ago
parent
commit
bee2a273bc
2 changed files with 9 additions and 2 deletions
  1. 8 2
      laravel/bundle.php
  2. 1 0
      laravel/documentation/changes.md

+ 8 - 2
laravel/bundle.php

@@ -422,13 +422,19 @@ class Bundle {
 	 *
 	 *
 	 * @param  string  $bundle
 	 * @param  string  $bundle
 	 * @param  string  $option
 	 * @param  string  $option
+	 * @param  mixed   $default
 	 * @return mixed
 	 * @return mixed
 	 */
 	 */
-	public static function option($bundle, $option)
+	public static function option($bundle, $option, $default = null)
 	{
 	{
 		$bundle = static::get($bundle);
 		$bundle = static::get($bundle);
 
 
-		if ( ! is_null($bundle)) return array_get($bundle, $option);
+		if (is_null($bundle))
+		{
+			return value($default);
+		}
+
+		return array_get($bundle, $option, $default);
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 0
laravel/documentation/changes.md

@@ -49,6 +49,7 @@
 - `Request::secure` now takes `application.ssl` configuration option into consideration.
 - `Request::secure` now takes `application.ssl` configuration option into consideration.
 - Simplified the `paths.php` file.
 - Simplified the `paths.php` file.
 - Only write file caches if number of minutes is greater than zero.
 - Only write file caches if number of minutes is greater than zero.
+- Added `$default` parameter to Bundle::option method.
 
 
 <a name="upgrade-3.2"></a>
 <a name="upgrade-3.2"></a>
 ## Upgrading From 3.1
 ## Upgrading From 3.1