[HttpFoundation] made small optimizations

This commit is contained in:
Fabien Potencier 2011-01-30 15:07:02 +01:00
parent 56483dc14f
commit 8dd0c5641a
3 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,10 @@ class HeaderBag
{ {
$this->cacheControl = array(); $this->cacheControl = array();
$this->cookies = array(); $this->cookies = array();
$this->replace($headers); $this->headers = array();
foreach ($headers as $key => $values) {
$this->set($key, $values);
}
} }
/** /**

View File

@ -27,7 +27,7 @@ class ParameterBag
*/ */
public function __construct(array $parameters = array()) public function __construct(array $parameters = array())
{ {
$this->replace($parameters); $this->parameters = $parameters;
} }
/** /**

View File

@ -511,7 +511,11 @@ class Request
$host = trim($elements[count($elements) - 1]); $host = trim($elements[count($elements) - 1]);
} else { } else {
$host = $this->headers->get('HOST', $this->server->get('SERVER_NAME', $this->server->get('SERVER_ADDR', ''))); if (!$host = $this->headers->get('HOST')) {
if (!$host = $this->server->get('SERVER_NAME')) {
$host = $this->server->get('SERVER_ADDR', '');
}
}
} }
// Remove port number from host // Remove port number from host