Skip to content

Commit 0b85c35

Browse files
committed
Fix up code formatting and structure for #3998
* Fix the various PHPCS errors. * Make the logic less complex.
1 parent e08b814 commit 0b85c35

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/Cake/Network/CakeResponse.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -517,20 +517,19 @@ protected function _setContentLength() {
517517
* @param string $name the header name
518518
* @param string $value the header value
519519
* @return void
520-
* @throws CakeException When an header already been sent
520+
* @throws CakeException When headers have already been sent
521521
*/
522-
protected function _sendHeader($name, $value = null) {
523-
if (!headers_sent($filename, $linenum)) {
524-
if ($value === null) {
525-
header($name);
526-
} else {
527-
header("{$name}: {$value}");
528-
}
529-
} else {
530-
if (Configure::read('debug')) {
531-
throw new CakeException(__d('cake_dev', 'Headers already sent in $filename on line $linenum'));
532-
}
533-
}
522+
protected function _sendHeader($name, $value = null) {
523+
if (headers_sent($filename, $linenum)) {
524+
throw new CakeException(
525+
__d('cake_dev', 'Headers already sent in %d on line %s', $linenum, $filename)
526+
);
527+
}
528+
if ($value === null) {
529+
header($name);
530+
} else {
531+
header("{$name}: {$value}");
532+
}
534533
}
535534

536535
/**

0 commit comments

Comments
 (0)