diff --git a/src/Illuminate/Routing/UrlGenerator.php b/src/Illuminate/Routing/UrlGenerator.php index 7a87d5118297..e1dd34af1363 100755 --- a/src/Illuminate/Routing/UrlGenerator.php +++ b/src/Illuminate/Routing/UrlGenerator.php @@ -320,19 +320,9 @@ public function formatScheme($secure = null) */ public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) { - $parameters = $this->formatParameters($parameters); - - if (array_key_exists('signature', $parameters)) { - throw new InvalidArgumentException( - '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' - ); - } - - if (array_key_exists('expires', $parameters)) { - throw new InvalidArgumentException( - '"Expires" is a reserved parameter when generating signed routes. Please rename your route parameter.' - ); - } + $this->ensureSignedRouteParametersAreNotReserved( + $parameters = $this->formatParameters($parameters) + ); if ($expiration) { $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; @@ -347,6 +337,27 @@ public function signedRoute($name, $parameters = [], $expiration = null, $absolu ], $absolute); } + /** + * Ensure the given signed route parameters are not reserved. + * + * @param mixed $parameters + * @return void + */ + protected function ensureSignedRouteParametersAreNotReserved($parameters) + { + if (array_key_exists('signature', $parameters)) { + throw new InvalidArgumentException( + '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + + if (array_key_exists('expires', $parameters)) { + throw new InvalidArgumentException( + '"Expires" is a reserved parameter when generating signed routes. Please rename your route parameter.' + ); + } + } + /** * Create a temporary signed route URL for a named route. *