Skip to content

Commit

Permalink
Fix up code formatting and structure for #3998
Browse files Browse the repository at this point in the history
* Fix the various PHPCS errors.
* Make the logic less complex.
  • Loading branch information
markstory committed Jul 29, 2014
1 parent e08b814 commit 0b85c35
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions lib/Cake/Network/CakeResponse.php
Expand Up @@ -517,20 +517,19 @@ protected function _setContentLength() {
* @param string $name the header name
* @param string $value the header value
* @return void
* @throws CakeException When an header already been sent
* @throws CakeException When headers have already been sent
*/
protected function _sendHeader($name, $value = null) {
if (!headers_sent($filename, $linenum)) {
if ($value === null) {
header($name);
} else {
header("{$name}: {$value}");
}
} else {
if (Configure::read('debug')) {
throw new CakeException(__d('cake_dev', 'Headers already sent in $filename on line $linenum'));
}
}
protected function _sendHeader($name, $value = null) {
if (headers_sent($filename, $linenum)) {
throw new CakeException(
__d('cake_dev', 'Headers already sent in %d on line %s', $linenum, $filename)
);
}
if ($value === null) {
header($name);
} else {
header("{$name}: {$value}");
}
}

/**
Expand Down

0 comments on commit 0b85c35

Please sign in to comment.