From 66c5e462dbdb9d0c9d23114da3a3dc1b6e9fa0a1 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 21 Sep 2017 09:05:48 -0500 Subject: [PATCH] formatting --- src/Illuminate/Routing/Router.php | 30 +++++++++---------- .../Integration/Routing/FallbackRouteTest.php | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index a392acb41c49..c2c61365afeb 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -551,6 +551,19 @@ protected function mergeGroupAttributesIntoRoute($route) $route->setAction($this->mergeWithLastGroup($route->getAction())); } + /** + * Return the response returned by the given route. + * + * @param string $name + * @return mixed + */ + public function respondWithRoute($name) + { + $route = tap($this->routes->getByName($name))->bind($this->currentRequest); + + return $this->runRoute($this->currentRequest, $route); + } + /** * Dispatch the request to the application. * @@ -572,7 +585,7 @@ public function dispatch(Request $request) */ public function dispatchToRoute(Request $request) { - return $this->buildResponse($request, $this->findRoute($request)); + return $this->runRoute($request, $this->findRoute($request)); } /** @@ -597,7 +610,7 @@ protected function findRoute($request) * @param Request $request * @return mixed */ - protected function buildResponse(Request $request, Route $route) + protected function runRoute(Request $request, Route $route) { $request->setRouteResolver(function () use ($route) { return $route; @@ -1109,19 +1122,6 @@ public function auth() $this->post('password/reset', 'Auth\ResetPasswordController@reset'); } - /** - * Return a response out of the given route. - * - * @param string $name - * @return mixed - */ - public function respondWith($name) - { - return $this->buildResponse($this->currentRequest, - tap($this->routes->getByName($name))->bind($this->currentRequest) - ); - } - /** * Set the unmapped global resource parameters to singular. * diff --git a/tests/Integration/Routing/FallbackRouteTest.php b/tests/Integration/Routing/FallbackRouteTest.php index a5d05c844405..93d06a7faa88 100644 --- a/tests/Integration/Routing/FallbackRouteTest.php +++ b/tests/Integration/Routing/FallbackRouteTest.php @@ -79,7 +79,7 @@ public function test_respond_with_named_fallback_route() })->name('testFallbackRoute'); Route::get('one', function () { - return Route::respondWith('testFallbackRoute'); + return Route::respondWithRoute('testFallbackRoute'); }); $this->assertContains('fallback', $this->get('/non-existing')->getContent());