From fd2ee008faf6d4feefc71abbfdba6b6936f79efa Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Wed, 27 May 2015 02:48:08 +0200 Subject: [PATCH] Implement helper method for redirecting --- framework/core/src/Support/Action.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Support/Action.php b/framework/core/src/Support/Action.php index 31599a950..b87fe9970 100644 --- a/framework/core/src/Support/Action.php +++ b/framework/core/src/Support/Action.php @@ -1,7 +1,8 @@ call($params); } + + /** + * @param string $url + * @return \Psr\Http\Message\ResponseInterface + */ + protected function redirectTo($url) + { + $content = sprintf(' + + + + + + Redirecting to %1$s + + + Redirecting to %1$s. + +', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')); + + return new Response($content, 302, ['location' => $url]); + } }