From 10f294d6bbb2ba9f3904a652f793c2d0ba00694b Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 28 Mar 2014 23:47:18 +0530 Subject: [PATCH] Remove $reponse param of Dispatcher::_invoke(). Use controller's $response property by default. --- lib/Cake/Routing/Dispatcher.php | 11 ++++++----- lib/Cake/Test/Case/Routing/DispatcherTest.php | 11 +++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 84935570afc..0d410fcdc8d 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -162,7 +162,7 @@ public function dispatch(CakeRequest $request, CakeResponse $response, $addition )); } - $response = $this->_invoke($controller, $request, $response); + $response = $this->_invoke($controller, $request); if (isset($request->params['return'])) { return $response->body(); } @@ -174,18 +174,19 @@ public function dispatch(CakeRequest $request, CakeResponse $response, $addition /** * Initializes the components and models a controller will be using. - * Triggers the controller action, and invokes the rendering if Controller::$autoRender is true and echo's the output. - * Otherwise the return value of the controller action are returned. + * Triggers the controller action, and invokes the rendering if Controller::$autoRender + * is true and echo's the output. Otherwise the return value of the controller + * action are returned. * * @param Controller $controller Controller to invoke * @param CakeRequest $request The request object to invoke the controller for. - * @param CakeResponse $response The response object to receive the output * @return CakeResponse the resulting response object */ - protected function _invoke(Controller $controller, CakeRequest $request, CakeResponse $response) { + protected function _invoke(Controller $controller, CakeRequest $request) { $controller->constructClasses(); $controller->startupProcess(); + $response = $controller->response; $render = true; $result = $controller->invokeAction($request); if ($result instanceof CakeResponse) { diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index 2d8f6620aa1..b43f61920f4 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -57,12 +57,11 @@ class TestDispatcher extends Dispatcher { * * @param Controller $controller * @param CakeRequest $request - * @param CakeResponse $response - * @return void + * @return CakeResponse */ - protected function _invoke(Controller $controller, CakeRequest $request, CakeResponse $response) { + protected function _invoke(Controller $controller, CakeRequest $request) { $this->controller = $controller; - return parent::_invoke($controller, $request, $response); + return parent::_invoke($controller, $request); } /** @@ -508,7 +507,7 @@ class TestFilterDispatcher extends DispatcherFilter { /** * TestFilterDispatcher::beforeDispatch() - * + * * @param mixed $event * @return CakeResponse|boolean */ @@ -521,7 +520,7 @@ public function beforeDispatch(CakeEvent $event) { /** * TestFilterDispatcher::afterDispatch() - * + * * @param mixed $event * @return mixed boolean to stop the event dispatching or null to continue */