Skip to content
Permalink
Browse files

Use new methods internally & deprecated part of header()

request->header() has a tricky mode where it automatically falls back to
env(). This violates the object encapsulation the request should be
trying to provide. Deprecating this behavior now allows us to make
header() a simple alias for getHeaderLine() in the future.
  • Loading branch information...
markstory committed Sep 24, 2016
1 parent 7e83776 commit 6a5d9b21ede23917e994f66f90ce2b883931b93e
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/Network/Request.php
@@ -961,8 +961,13 @@ protected function normalizeHeaderName($name)
/**
* Read an HTTP header from the Request information.
*
* If the header is not defined in the request, this method
* will fallback to reading data from $_SERVER and $_ENV.
* This fallback behavior is deprecated, and will be removed in 4.0.0
*
* @param string $name Name of the header you want.
* @return string|null Either null on no header being set or the value of the header.
* @deprecated 4.0.0 The automatic fallback to env() will be removed in 4.0.0
*/
public function header($name)
{
@@ -1311,7 +1316,7 @@ public function accepts($type = null)
*/
public function parseAccept()
{
return $this->_parseAcceptWithQualifier($this->header('accept'));
return $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept'));
}
/**
@@ -1330,7 +1335,7 @@ public function parseAccept()
*/
public function acceptLanguage($language = null)
{
$raw = $this->_parseAcceptWithQualifier($this->header('Accept-Language'));
$raw = $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept-Language'));
$accept = [];
foreach ($raw as $languages) {
foreach ($languages as &$lang) {

0 comments on commit 6a5d9b2

Please sign in to comment.
You can’t perform that action at this time.