Skip to content

Commit

Permalink
[HttpFoundation] tweaked HeaderBag::__toString() to ease debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 15, 2011
1 parent e81b88c commit 11fa8d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Symfony/Component/HttpFoundation/HeaderBag.php
Expand Up @@ -48,10 +48,11 @@ public function __toString()
return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", ucfirst($name));
};

$max = max(array_map('strlen', array_keys($this->headers))) + 1;
$content = '';
foreach ($this->headers as $name => $values) {
foreach ($values as $value) {
$content .= sprintf("%s: %s\r\n", $beautifier($name), $value);
$content .= sprintf("%-{$max}s %s\r\n", $beautifier($name).':', $value);
}
}

Expand Down

0 comments on commit 11fa8d8

Please sign in to comment.