Permalink
Browse files

HttpFoundation\HeaderBag Little improvement.

  • Loading branch information...
1 parent 8452eb6 commit f684de914646391b1242e79db579649580a67c0c @protaskin protaskin committed Mar 24, 2012
Showing with 2 additions and 5 deletions.
  1. +2 −5 HeaderBag.php
View
@@ -50,16 +50,13 @@ public function __toString()
return '';
}
- $beautifier = function ($name) {
- return preg_replace_callback('/\-(.)/', function ($match) { return '-'.strtoupper($match[1]); }, ucfirst($name));
- };
-
$max = max(array_map('strlen', array_keys($this->headers))) + 1;
$content = '';
ksort($this->headers);
foreach ($this->headers as $name => $values) {
+ $name = implode('-', array_map('ucfirst', explode('-', $name)));
foreach ($values as $value) {
- $content .= sprintf("%-{$max}s %s\r\n", $beautifier($name).':', $value);
+ $content .= sprintf("%-{$max}s %s\r\n", $name.':', $value);
}
}

0 comments on commit f684de9

Please sign in to comment.