From 0b85c356350b5f0cf826acb54221f712f7cb7df2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 28 Jul 2014 21:47:35 -0400 Subject: [PATCH] Fix up code formatting and structure for #3998 * Fix the various PHPCS errors. * Make the logic less complex. --- lib/Cake/Network/CakeResponse.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index c0c48cb25..b528ed28c 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -517,20 +517,19 @@ class CakeResponse { * @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}"); + } } /**