From 7e33b4f85214e45a577d374883c1dca6a48f74bc Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 29 Nov 2011 22:32:05 -0600 Subject: [PATCH] cleaning up some code comments. --- laravel/url.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/laravel/url.php b/laravel/url.php index e497f721..78fc9cee 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -124,20 +124,18 @@ public static function to_route($name, $parameters = array(), $https = false) { $uris = explode(', ', key($route)); - // Grab the first URI assigned to the route and remove the URI and - // leading slash from the destination that's defined on the route. $uri = substr($uris[0], strpos($uris[0], '/')); // Spin through each route parameter and replace the route wildcard // segment with the corresponding parameter passed to the method. + // Afterwards, we will replace all of the remaining optional URI + // segments with spaces since they may not have been specified + // in the array of parameters. foreach ((array) $parameters as $parameter) { $uri = preg_replace('/\(.+?\)/', $parameter, $uri, 1); } - // Replace all remaining optional segments with spaces. Since the - // segments are optional, some of them may not have been assigned - // values from the parameter array. return static::to(str_replace(array('/(:any?)', '/(:num?)'), '', $uri), $https); }