Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

HttpFoundation\HeaderBag Little improvement.

  • Loading branch information...
commit b71896085744e22fce05cfccce12e642bc5ebc51 1 parent a00ae27
@protaskin protaskin authored
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/Symfony/Component/HttpFoundation/HeaderBag.php
View
7 src/Symfony/Component/HttpFoundation/HeaderBag.php
@@ -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);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.