From c9e59c3b51c31113633cd33bfb4fb1e8ed36f033 Mon Sep 17 00:00:00 2001 From: Phally Date: Sat, 5 May 2012 17:09:43 +0200 Subject: [PATCH] Removed triple nested condition. --- lib/Cake/Controller/Controller.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index ec862aec578..6341a49017c 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -774,13 +774,14 @@ public function redirect($url, $status = null, $exit = true) { $this->response->header('Location', Router::url($url, true)); } - if (!empty($status)) { - if (is_string($status)) { - $codes = array_flip($this->response->httpCodes()); - if (isset($codes[$status])) { - $status = $codes[$status]; - } + if (is_string($status)) { + $codes = array_flip($this->response->httpCodes()); + if (isset($codes[$status])) { + $status = $codes[$status]; } + } + + if ($status) { $this->response->statusCode($status); }