Skip to content

Commit

Permalink
Removed triple nested condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Phally authored and lorenzo committed May 11, 2012
1 parent 2be9ac8 commit c9e59c3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -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);
}

Expand Down

0 comments on commit c9e59c3

Please sign in to comment.