updated packages
This commit is contained in:
@@ -24,11 +24,11 @@ class ResponseHeaderBag extends HeaderBag
|
||||
const DISPOSITION_ATTACHMENT = 'attachment';
|
||||
const DISPOSITION_INLINE = 'inline';
|
||||
|
||||
protected $computedCacheControl = array();
|
||||
protected $cookies = array();
|
||||
protected $headerNames = array();
|
||||
protected $computedCacheControl = [];
|
||||
protected $cookies = [];
|
||||
protected $headerNames = [];
|
||||
|
||||
public function __construct(array $headers = array())
|
||||
public function __construct(array $headers = [])
|
||||
{
|
||||
parent::__construct($headers);
|
||||
|
||||
@@ -49,7 +49,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
*/
|
||||
public function allPreserveCase()
|
||||
{
|
||||
$headers = array();
|
||||
$headers = [];
|
||||
foreach ($this->all() as $name => $value) {
|
||||
$headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value;
|
||||
}
|
||||
@@ -70,9 +70,9 @@ class ResponseHeaderBag extends HeaderBag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function replace(array $headers = array())
|
||||
public function replace(array $headers = [])
|
||||
{
|
||||
$this->headerNames = array();
|
||||
$this->headerNames = [];
|
||||
|
||||
parent::replace($headers);
|
||||
|
||||
@@ -107,7 +107,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
|
||||
if ('set-cookie' === $uniqueKey) {
|
||||
if ($replace) {
|
||||
$this->cookies = array();
|
||||
$this->cookies = [];
|
||||
}
|
||||
foreach ((array) $values as $cookie) {
|
||||
$this->setCookie(Cookie::fromString($cookie));
|
||||
@@ -122,9 +122,9 @@ class ResponseHeaderBag extends HeaderBag
|
||||
parent::set($key, $values, $replace);
|
||||
|
||||
// ensure the cache-control header has sensible defaults
|
||||
if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) {
|
||||
if (\in_array($uniqueKey, ['cache-control', 'etag', 'last-modified', 'expires'], true)) {
|
||||
$computed = $this->computeCacheControlValue();
|
||||
$this->headers['cache-control'] = array($computed);
|
||||
$this->headers['cache-control'] = [$computed];
|
||||
$this->headerNames['cache-control'] = 'Cache-Control';
|
||||
$this->computedCacheControl = $this->parseCacheControl($computed);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
unset($this->headerNames[$uniqueKey]);
|
||||
|
||||
if ('set-cookie' === $uniqueKey) {
|
||||
$this->cookies = array();
|
||||
$this->cookies = [];
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
parent::remove($key);
|
||||
|
||||
if ('cache-control' === $uniqueKey) {
|
||||
$this->computedCacheControl = array();
|
||||
$this->computedCacheControl = [];
|
||||
}
|
||||
|
||||
if ('date' === $uniqueKey) {
|
||||
@@ -160,7 +160,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
*/
|
||||
public function hasCacheControlDirective($key)
|
||||
{
|
||||
return array_key_exists($key, $this->computedCacheControl);
|
||||
return \array_key_exists($key, $this->computedCacheControl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ class ResponseHeaderBag extends HeaderBag
|
||||
*/
|
||||
public function getCacheControlDirective($key)
|
||||
{
|
||||
return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null;
|
||||
return \array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null;
|
||||
}
|
||||
|
||||
public function setCookie(Cookie $cookie)
|
||||
@@ -216,15 +216,15 @@ class ResponseHeaderBag extends HeaderBag
|
||||
*/
|
||||
public function getCookies($format = self::COOKIES_FLAT)
|
||||
{
|
||||
if (!\in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) {
|
||||
throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY))));
|
||||
if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
|
||||
throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
|
||||
}
|
||||
|
||||
if (self::COOKIES_ARRAY === $format) {
|
||||
return $this->cookies;
|
||||
}
|
||||
|
||||
$flattenedCookies = array();
|
||||
$flattenedCookies = [];
|
||||
foreach ($this->cookies as $path) {
|
||||
foreach ($path as $cookies) {
|
||||
foreach ($cookies as $cookie) {
|
||||
|
||||
Reference in New Issue
Block a user