From bee2a273bc393aa13e90e0e2b28f8bed67ae0dd2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 18 Apr 2012 20:47:29 -0500 Subject: [PATCH] added default option to bundle::option method. --- laravel/bundle.php | 10 ++++++++-- laravel/documentation/changes.md | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index b6f614e9..15b9b3da 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -422,13 +422,19 @@ public static function get($bundle) * * @param string $bundle * @param string $option + * @param mixed $default * @return mixed */ - public static function option($bundle, $option) + public static function option($bundle, $option, $default = null) { $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); } /** diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index 6e4c7b7a..3b56a359 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -49,6 +49,7 @@ ## Laravel 3.2 - `Request::secure` now takes `application.ssl` configuration option into consideration. - Simplified the `paths.php` file. - Only write file caches if number of minutes is greater than zero. +- Added `$default` parameter to Bundle::option method. ## Upgrading From 3.1