Laravel version update
Laravel version update
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -39,7 +37,6 @@ use stdClass;
|
||||
abstract class AbstractAccept implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var stdClass[]
|
||||
*/
|
||||
protected $fieldValueParts = [];
|
||||
@@ -99,8 +96,8 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
public function getFieldValuePartsFromHeaderLine($headerLine)
|
||||
{
|
||||
// process multiple accept values, they may be between quotes
|
||||
if (!preg_match_all('/(?:[^,"]|"(?:[^\\\"]|\\\.)*")+/', $headerLine, $values)
|
||||
|| !isset($values[0])
|
||||
if (! preg_match_all('/(?:[^,"]|"(?:[^\\\"]|\\\.)*")+/', $headerLine, $values)
|
||||
|| ! isset($values[0])
|
||||
) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Invalid header line for ' . $this->getFieldName() . ' header string'
|
||||
@@ -139,14 +136,14 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
$subtype = '*';
|
||||
|
||||
return (object) [
|
||||
'typeString' => trim($fieldValuePart),
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'subtypeRaw' => $subtypeWhole,
|
||||
'format' => $format,
|
||||
'priority' => isset($params['q']) ? $params['q'] : 1,
|
||||
'params' => $params,
|
||||
'raw' => trim($raw)
|
||||
'typeString' => trim($fieldValuePart),
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'subtypeRaw' => $subtypeWhole,
|
||||
'format' => $format,
|
||||
'priority' => isset($params['q']) ? $params['q'] : 1,
|
||||
'params' => $params,
|
||||
'raw' => trim($raw),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -219,8 +216,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
*/
|
||||
protected function assembleAcceptParam(&$value, $key)
|
||||
{
|
||||
$separators = ['(', ')', '<', '>', '@', ',', ';', ':',
|
||||
'/', '[', ']', '?', '=', '{', '}', ' ', "\t"];
|
||||
$separators = ['(', ')', '<', '>', '@', ',', ';', ':', '/', '[', ']', '?', '=', '{', '}', ' ', "\t"];
|
||||
|
||||
$escaped = preg_replace_callback(
|
||||
'/[[:cntrl:]"\\\\]/', // escape cntrl, ", \
|
||||
@@ -230,7 +226,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
$value
|
||||
);
|
||||
|
||||
if ($escaped == $value && !array_intersect(str_split($value), $separators)) {
|
||||
if ($escaped == $value && ! array_intersect(str_split($value), $separators)) {
|
||||
$value = $key . ($value ? '=' . $value : '');
|
||||
} else {
|
||||
$value = $key . ($value ? '="' . $escaped . '"' : '');
|
||||
@@ -250,7 +246,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
*/
|
||||
protected function addType($type, $priority = 1, array $params = [])
|
||||
{
|
||||
if (!preg_match($this->regexAddType, $type)) {
|
||||
if (! preg_match($this->regexAddType, $type)) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'%s expects a valid type; received "%s"',
|
||||
__METHOD__,
|
||||
@@ -258,7 +254,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
));
|
||||
}
|
||||
|
||||
if (!is_int($priority) && !is_float($priority) && !is_numeric($priority)
|
||||
if (! is_int($priority) && ! is_float($priority) && ! is_numeric($priority)
|
||||
|| $priority > 1 || $priority < 0
|
||||
) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
@@ -315,8 +311,8 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
}
|
||||
|
||||
if ($left->type == $right->type) {
|
||||
if (($left->subtype == $right->subtype || ($right->subtype == '*' || $left->subtype == '*')) &&
|
||||
($left->format == $right->format || $right->format == '*' || $left->format == '*')
|
||||
if (($left->subtype == $right->subtype || ($right->subtype == '*' || $left->subtype == '*'))
|
||||
&& ($left->format == $right->format || $right->format == '*' || $left->format == '*')
|
||||
) {
|
||||
if ($this->matchAcceptParams($left, $right)) {
|
||||
$left->setMatchedAgainst($right);
|
||||
@@ -349,10 +345,9 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
$pieces
|
||||
);
|
||||
|
||||
if (count($pieces) == 3 &&
|
||||
(version_compare($pieces[1], $match1->params[$key], '<=') xor
|
||||
version_compare($pieces[2], $match1->params[$key], '>=')
|
||||
)
|
||||
if (count($pieces) == 3
|
||||
&& (version_compare($pieces[1], $match1->params[$key], '<=')
|
||||
xor version_compare($pieces[2], $match1->params[$key], '>='))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -366,7 +361,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (!$good) {
|
||||
if (! $good) {
|
||||
return false;
|
||||
}
|
||||
} elseif ($match1->params[$key] != $value) {
|
||||
@@ -411,7 +406,8 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
*/
|
||||
protected function sortFieldValueParts()
|
||||
{
|
||||
$sort = function ($a, $b) { // If A has higher precedence than B, return -1.
|
||||
$sort = function ($a, $b) {
|
||||
// If A has higher precedence than B, return -1.
|
||||
if ($a->priority > $b->priority) {
|
||||
return -1;
|
||||
} elseif ($a->priority < $b->priority) {
|
||||
@@ -434,7 +430,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
return 1;
|
||||
}
|
||||
|
||||
//@todo count number of dots in case of type==application in subtype
|
||||
// @todo count number of dots in case of type==application in subtype
|
||||
|
||||
// So far they're still the same. Longest string length may be more specific
|
||||
if (strlen($a->raw) == strlen($b->raw)) {
|
||||
@@ -452,7 +448,7 @@ abstract class AbstractAccept implements HeaderInterface
|
||||
*/
|
||||
public function getPrioritized()
|
||||
{
|
||||
if (!$this->sorted) {
|
||||
if (! $this->sorted) {
|
||||
$this->sortFieldValueParts();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -41,7 +39,7 @@ abstract class AbstractDate implements HeaderInterface
|
||||
*
|
||||
* @var DateTime
|
||||
*/
|
||||
protected $date = null;
|
||||
protected $date;
|
||||
|
||||
/**
|
||||
* Date output format
|
||||
@@ -134,10 +132,11 @@ abstract class AbstractDate implements HeaderInterface
|
||||
*/
|
||||
public static function setDateFormat($format)
|
||||
{
|
||||
if (!isset(static::$dateFormats[$format])) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
"No constant defined for provided date format: {$format}"
|
||||
);
|
||||
if (! isset(static::$dateFormats[$format])) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'No constant defined for provided date format: %s',
|
||||
$format
|
||||
));
|
||||
}
|
||||
|
||||
static::$dateFormat = static::$dateFormats[$format];
|
||||
@@ -172,7 +171,7 @@ abstract class AbstractDate implements HeaderInterface
|
||||
$e
|
||||
);
|
||||
}
|
||||
} elseif (!($date instanceof DateTime)) {
|
||||
} elseif (! ($date instanceof DateTime)) {
|
||||
throw new Exception\InvalidArgumentException('Date must be an instance of \DateTime or a string');
|
||||
}
|
||||
|
||||
@@ -226,7 +225,7 @@ abstract class AbstractDate implements HeaderInterface
|
||||
$e
|
||||
);
|
||||
}
|
||||
} elseif (!($date instanceof DateTime)) {
|
||||
} elseif (! ($date instanceof DateTime)) {
|
||||
throw new Exception\InvalidArgumentException('Date must be an instance of \DateTime or a string');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -31,7 +29,7 @@ abstract class AbstractLocation implements HeaderInterface
|
||||
*
|
||||
* @var UriInterface
|
||||
*/
|
||||
protected $uri = null;
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* Create location-based header from string
|
||||
@@ -79,7 +77,7 @@ abstract class AbstractLocation implements HeaderInterface
|
||||
$e
|
||||
);
|
||||
}
|
||||
} elseif (!($uri instanceof UriInterface)) {
|
||||
} elseif (! ($uri instanceof UriInterface)) {
|
||||
throw new Exception\InvalidArgumentException('URI must be an instance of Zend\Uri\Http or a string');
|
||||
}
|
||||
$this->uri = $uri;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
@@ -12,7 +10,6 @@ namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
/**
|
||||
* Field Value Part
|
||||
*
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
||||
*/
|
||||
abstract class AbstractFieldValuePart
|
||||
@@ -30,7 +27,6 @@ abstract class AbstractFieldValuePart
|
||||
protected $matchedAgainst;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param object $internalValues
|
||||
*/
|
||||
public function __construct($internalValues)
|
||||
@@ -61,7 +57,6 @@ abstract class AbstractFieldValuePart
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function getInternalValues()
|
||||
@@ -102,8 +97,7 @@ abstract class AbstractFieldValuePart
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mixed
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
@@ -12,7 +10,6 @@ namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
/**
|
||||
* Field Value Part
|
||||
*
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
||||
*/
|
||||
class AcceptFieldValuePart extends AbstractFieldValuePart
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
@@ -12,13 +10,11 @@ namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
/**
|
||||
* Field Value Part
|
||||
*
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
||||
*/
|
||||
class CharsetFieldValuePart extends AbstractFieldValuePart
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCharset()
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
@@ -12,13 +10,11 @@ namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
/**
|
||||
* Field Value Part
|
||||
*
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
||||
*/
|
||||
class EncodingFieldValuePart extends AbstractFieldValuePart
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncoding()
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
@@ -12,7 +10,6 @@ namespace Zend\Http\Header\Accept\FieldValuePart;
|
||||
/**
|
||||
* Field Value Part
|
||||
*
|
||||
*
|
||||
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
||||
*/
|
||||
class LanguageFieldValuePart extends AbstractFieldValuePart
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -86,7 +84,7 @@ class AcceptLanguage extends AbstractAccept
|
||||
}
|
||||
|
||||
if (strpos($fieldValuePart, '-')) {
|
||||
$subtypeWhole = $format = $subtype = trim(substr($fieldValuePart, strpos($fieldValuePart, '-')+1));
|
||||
$subtypeWhole = $format = $subtype = trim(substr($fieldValuePart, strpos($fieldValuePart, '-') + 1));
|
||||
} else {
|
||||
$subtypeWhole = '';
|
||||
$format = '*';
|
||||
@@ -94,14 +92,14 @@ class AcceptLanguage extends AbstractAccept
|
||||
}
|
||||
|
||||
$aggregated = [
|
||||
'typeString' => trim($fieldValuePart),
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'subtypeRaw' => $subtypeWhole,
|
||||
'format' => $format,
|
||||
'priority' => isset($params['q']) ? $params['q'] : 1,
|
||||
'params' => $params,
|
||||
'raw' => trim($raw)
|
||||
'typeString' => trim($fieldValuePart),
|
||||
'type' => $type,
|
||||
'subtype' => $subtype,
|
||||
'subtypeRaw' => $subtypeWhole,
|
||||
'format' => $format,
|
||||
'priority' => isset($params['q']) ? $params['q'] : 1,
|
||||
'params' => $params,
|
||||
'raw' => trim($raw),
|
||||
];
|
||||
|
||||
return new FieldValuePart\LanguageFieldValuePart((object) $aggregated);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class AuthenticationInfo implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -41,7 +39,7 @@ class CacheControl implements HeaderInterface
|
||||
// check to ensure proper header type for this factory
|
||||
if (strtolower($name) !== 'cache-control') {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'Invalid header line for Cache-Control string: ""',
|
||||
'Invalid header line for Cache-Control string: "%s"',
|
||||
$name
|
||||
));
|
||||
}
|
||||
@@ -145,9 +143,9 @@ class CacheControl implements HeaderInterface
|
||||
$parts[] = $key;
|
||||
} else {
|
||||
if (preg_match('#[^a-zA-Z0-9._-]#', $value)) {
|
||||
$value = '"' . $value.'"';
|
||||
$value = '"' . $value . '"';
|
||||
}
|
||||
$parts[] = "$key=$value";
|
||||
$parts[] = $key . '=' . $value;
|
||||
}
|
||||
}
|
||||
return implode(', ', $parts);
|
||||
@@ -223,7 +221,6 @@ class CacheControl implements HeaderInterface
|
||||
|
||||
default:
|
||||
throw new Exception\InvalidArgumentException('expected SEPARATOR or END');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -27,7 +25,7 @@ class Connection implements HeaderInterface
|
||||
protected $value = self::CONNECTION_KEEP_ALIVE;
|
||||
|
||||
/**
|
||||
* @param $headerLine
|
||||
* @param string $headerLine
|
||||
* @return Connection
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class ContentDisposition implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -73,6 +71,12 @@ class ContentSecurityPolicy implements HeaderInterface
|
||||
));
|
||||
}
|
||||
if (empty($sources)) {
|
||||
if ('report-uri' === $name) {
|
||||
if (isset($this->directives[$name])) {
|
||||
unset($this->directives[$name]);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
$this->directives[$name] = "'none'";
|
||||
return $this;
|
||||
}
|
||||
@@ -109,7 +113,7 @@ class ContentSecurityPolicy implements HeaderInterface
|
||||
$token = trim($token);
|
||||
if ($token) {
|
||||
list($directiveName, $directiveValue) = explode(' ', $token, 2);
|
||||
if (!isset($header->directives[$directiveName])) {
|
||||
if (! isset($header->directives[$directiveName])) {
|
||||
$header->setDirective($directiveName, [$directiveValue]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -50,15 +48,15 @@ class ContentType implements HeaderInterface
|
||||
));
|
||||
}
|
||||
|
||||
$parts = explode(';', $value);
|
||||
$mediaType = array_shift($parts);
|
||||
$header = new static($value, trim($mediaType));
|
||||
$parts = explode(';', $value);
|
||||
$mediaType = array_shift($parts);
|
||||
$header = new static($value, trim($mediaType));
|
||||
|
||||
if (count($parts) > 0) {
|
||||
$parameters = [];
|
||||
foreach ($parts as $parameter) {
|
||||
$parameter = trim($parameter);
|
||||
if (!preg_match('/^(?P<key>[^\s\=]+)\="?(?P<value>[^\s\"]*)"?$/', $parameter, $matches)) {
|
||||
if (! preg_match('/^(?P<key>[^\s\=]+)\="?(?P<value>[^\s\"]*)"?$/', $parameter, $matches)) {
|
||||
continue;
|
||||
}
|
||||
$parameters[$matches['key']] = $matches['value'];
|
||||
@@ -228,7 +226,7 @@ class ContentType implements HeaderInterface
|
||||
if (isset($this->parameters['charset'])) {
|
||||
return $this->parameters['charset'];
|
||||
}
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,7 +280,7 @@ class ContentType implements HeaderInterface
|
||||
*/
|
||||
protected function getMediaTypeObjectFromString($string)
|
||||
{
|
||||
if (!is_string($string)) {
|
||||
if (! is_string($string)) {
|
||||
throw new Exception\InvalidArgumentException(sprintf(
|
||||
'Non-string mediatype "%s" provided',
|
||||
(is_object($string) ? get_class($string) : gettype($string))
|
||||
@@ -300,7 +298,7 @@ class ContentType implements HeaderInterface
|
||||
$type = array_shift($parts);
|
||||
$subtype = array_shift($parts);
|
||||
$format = $subtype;
|
||||
if (strstr($subtype, '+')) {
|
||||
if (false !== strpos($subtype, '+')) {
|
||||
$parts = explode('+', $subtype, 2);
|
||||
$subtype = array_shift($parts);
|
||||
$format = array_shift($parts);
|
||||
@@ -337,7 +335,7 @@ class ContentType implements HeaderInterface
|
||||
// Is the right side a partial wildcard?
|
||||
if ('*' == substr($right->subtype, -1)) {
|
||||
// validate partial-wildcard subtype
|
||||
if (!$this->validatePartialWildcard($right->subtype, $left->subtype)) {
|
||||
if (! $this->validatePartialWildcard($right->subtype, $left->subtype)) {
|
||||
return false;
|
||||
}
|
||||
// Finally, verify format is valid
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -97,13 +95,28 @@ class Cookie extends ArrayObject implements HeaderInterface
|
||||
{
|
||||
$nvPairs = [];
|
||||
|
||||
foreach ($this as $name => $value) {
|
||||
foreach ($this->flattenCookies($this) as $name => $value) {
|
||||
$nvPairs[] = $name . '=' . (($this->encodeValue) ? urlencode($value) : $value);
|
||||
}
|
||||
|
||||
return implode('; ', $nvPairs);
|
||||
}
|
||||
|
||||
protected function flattenCookies($data, $prefix = null)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$key = $prefix ? $prefix . '[' . $key . ']' : $key;
|
||||
if (is_array($value)) {
|
||||
$result = array_merge($result, $this->flattenCookies($value, $key));
|
||||
} else {
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return 'Cookie: ' . $this->getFieldValue();
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Exception;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Exception;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Exception;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header\Exception;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -25,4 +23,12 @@ class Expires extends AbstractDate
|
||||
{
|
||||
return 'Expires';
|
||||
}
|
||||
|
||||
public function setDate($date)
|
||||
{
|
||||
if ($date === '0' || $date === 0) {
|
||||
$date = date(DATE_W3C, 0); // Thu, 01 Jan 1970 00:00:00 GMT
|
||||
}
|
||||
return parent::setDate($date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
/**
|
||||
* Content-Location Header
|
||||
*
|
||||
*/
|
||||
*/
|
||||
class GenericHeader implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fieldName = null;
|
||||
protected $fieldName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fieldValue = null;
|
||||
protected $fieldValue;
|
||||
|
||||
/**
|
||||
* Factory to generate a header object from a string
|
||||
@@ -88,7 +85,7 @@ class GenericHeader implements HeaderInterface
|
||||
*/
|
||||
public function setFieldName($fieldName)
|
||||
{
|
||||
if (!is_string($fieldName) || empty($fieldName)) {
|
||||
if (! is_string($fieldName) || empty($fieldName)) {
|
||||
throw new Exception\InvalidArgumentException('Header name must be a string');
|
||||
}
|
||||
|
||||
@@ -101,7 +98,7 @@ class GenericHeader implements HeaderInterface
|
||||
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
|
||||
* "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
|
||||
*/
|
||||
if (!preg_match('/^[!#$%&\'*+\-\.\^_`|~0-9a-zA-Z]+$/', $fieldName)) {
|
||||
if (! preg_match('/^[!#$%&\'*+\-\.\^_`|~0-9a-zA-Z]+$/', $fieldName)) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Header name must be a valid RFC 7230 (section 3.2) field-name.'
|
||||
);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -32,8 +30,10 @@ class GenericMultiHeader extends GenericHeader implements MultipleHeaderInterfac
|
||||
$name = $this->getFieldName();
|
||||
$values = [$this->getFieldValue()];
|
||||
foreach ($headers as $header) {
|
||||
if (!$header instanceof static) {
|
||||
throw new Exception\InvalidArgumentException('This method toStringMultipleHeaders was expecting an array of headers of the same type');
|
||||
if (! $header instanceof static) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'This method toStringMultipleHeaders was expecting an array of headers of the same type'
|
||||
);
|
||||
}
|
||||
$values[] = $header->getFieldValue();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class IfRange implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -32,7 +30,7 @@ class Origin implements HeaderInterface
|
||||
}
|
||||
|
||||
$uri = UriFactory::factory($value);
|
||||
if (!$uri->isValid()) {
|
||||
if (! $uri->isValid()) {
|
||||
throw new Exception\InvalidArgumentException('Invalid header value for Origin key: "' . $name . '"');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -65,7 +63,7 @@ class ProxyAuthenticate implements MultipleHeaderInterface
|
||||
{
|
||||
$strings = [$this->toString()];
|
||||
foreach ($headers as $header) {
|
||||
if (!$header instanceof ProxyAuthenticate) {
|
||||
if (! $header instanceof ProxyAuthenticate) {
|
||||
throw new Exception\RuntimeException(
|
||||
'The ProxyAuthenticate multiple header implementation can only accept'
|
||||
. ' an array of ProxyAuthenticate headers'
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class Refresh implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -24,56 +22,56 @@ class SetCookie implements MultipleHeaderInterface
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $name = null;
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Cookie value
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $value = null;
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
protected $version = null;
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* Max Age
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
protected $maxAge = null;
|
||||
protected $maxAge;
|
||||
|
||||
/**
|
||||
* Cookie expiry date
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
protected $expires = null;
|
||||
protected $expires;
|
||||
|
||||
/**
|
||||
* Cookie domain
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $domain = null;
|
||||
protected $domain;
|
||||
|
||||
/**
|
||||
* Cookie path
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $path = null;
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* Whether the cookie is secure or not
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
protected $secure = null;
|
||||
protected $secure;
|
||||
|
||||
/**
|
||||
* If the value need to be quoted or not
|
||||
@@ -85,7 +83,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
protected $httponly = null;
|
||||
protected $httponly;
|
||||
|
||||
/**
|
||||
* @static
|
||||
@@ -101,13 +99,13 @@ class SetCookie implements MultipleHeaderInterface
|
||||
if ($setCookieProcessor === null) {
|
||||
$setCookieClass = get_called_class();
|
||||
$setCookieProcessor = function ($headerLine) use ($setCookieClass) {
|
||||
$header = new $setCookieClass;
|
||||
$header = new $setCookieClass();
|
||||
$keyValuePairs = preg_split('#;\s*#', $headerLine);
|
||||
|
||||
foreach ($keyValuePairs as $keyValue) {
|
||||
if (preg_match('#^(?P<headerKey>[^=]+)=\s*("?)(?P<headerValue>[^"]*)\2#', $keyValue, $matches)) {
|
||||
$headerKey = $matches['headerKey'];
|
||||
$headerValue= $matches['headerValue'];
|
||||
$headerValue = $matches['headerValue'];
|
||||
} else {
|
||||
$headerKey = $keyValue;
|
||||
$headerValue = null;
|
||||
@@ -141,7 +139,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
$header->setVersion((int) $headerValue);
|
||||
break;
|
||||
case 'maxage':
|
||||
$header->setMaxAge((int) $headerValue);
|
||||
$header->setMaxAge($headerValue);
|
||||
break;
|
||||
default:
|
||||
// Intentionally omitted
|
||||
@@ -156,7 +154,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
HeaderValue::assertValid($value);
|
||||
|
||||
// some sites return set-cookie::value, this is to get rid of the second :
|
||||
$name = (strtolower($name) =='set-cookie:') ? 'set-cookie' : $name;
|
||||
$name = strtolower($name) == 'set-cookie:' ? 'set-cookie' : $name;
|
||||
|
||||
// check to ensure proper header type for this factory
|
||||
if (strtolower($name) !== 'set-cookie') {
|
||||
@@ -235,7 +233,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
|
||||
$value = urlencode($this->getValue());
|
||||
if ($this->hasQuoteFieldValue()) {
|
||||
$value = '"'. $value . '"';
|
||||
$value = '"' . $value . '"';
|
||||
}
|
||||
|
||||
$fieldValue = $this->getName() . '=' . $value;
|
||||
@@ -246,7 +244,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
}
|
||||
|
||||
$maxAge = $this->getMaxAge();
|
||||
if ($maxAge!==null) {
|
||||
if ($maxAge !== null) {
|
||||
$fieldValue .= '; Max-Age=' . $maxAge;
|
||||
}
|
||||
|
||||
@@ -323,7 +321,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
*/
|
||||
public function setVersion($version)
|
||||
{
|
||||
if ($version !== null && !is_int($version)) {
|
||||
if ($version !== null && ! is_int($version)) {
|
||||
throw new Exception\InvalidArgumentException('Invalid Version number specified');
|
||||
}
|
||||
$this->version = $version;
|
||||
@@ -344,15 +342,15 @@ class SetCookie implements MultipleHeaderInterface
|
||||
* Set Max-Age
|
||||
*
|
||||
* @param int $maxAge
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return SetCookie
|
||||
*/
|
||||
public function setMaxAge($maxAge)
|
||||
{
|
||||
if ($maxAge !== null && (!is_int($maxAge) || ($maxAge < 0))) {
|
||||
throw new Exception\InvalidArgumentException('Invalid Max-Age number specified');
|
||||
if ($maxAge === null || ! is_numeric($maxAge)) {
|
||||
return $this;
|
||||
}
|
||||
$this->maxAge = $maxAge;
|
||||
|
||||
$this->maxAge = max(0, (int) $maxAge);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -392,7 +390,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
$tsExpires = strtotime($expires);
|
||||
|
||||
// if $tsExpires is invalid and PHP is compiled as 32bit. Check if it fail reason is the 2038 bug
|
||||
if (!is_int($tsExpires) && PHP_INT_SIZE === 4) {
|
||||
if (! is_int($tsExpires) && PHP_INT_SIZE === 4) {
|
||||
$dateTime = new DateTime($expires);
|
||||
if ($dateTime->format('Y') > 2038) {
|
||||
$tsExpires = PHP_INT_MAX;
|
||||
@@ -400,7 +398,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_int($tsExpires) || $tsExpires < 0) {
|
||||
if (! is_int($tsExpires) || $tsExpires < 0) {
|
||||
throw new Exception\InvalidArgumentException('Invalid expires time specified');
|
||||
}
|
||||
|
||||
@@ -567,7 +565,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->secure && $this->isSecure()!==$isSecure) {
|
||||
if ($this->secure && $this->isSecure() !== $isSecure) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -590,7 +588,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
}
|
||||
|
||||
// Make sure we have a valid Zend_Uri_Http object
|
||||
if (! ($uri->isValid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
|
||||
if (! ($uri->isValid() && ($uri->getScheme() == 'http' || $uri->getScheme() == 'https'))) {
|
||||
throw new Exception\InvalidArgumentException('Passed URI is not a valid HTTP or HTTPS URI');
|
||||
}
|
||||
|
||||
@@ -634,8 +632,8 @@ class SetCookie implements MultipleHeaderInterface
|
||||
$cookieDomain = strtolower($cookieDomain);
|
||||
$host = strtolower($host);
|
||||
// Check for either exact match or suffix match
|
||||
return ($cookieDomain == $host ||
|
||||
preg_match('/' . preg_quote($cookieDomain) . '$/', $host));
|
||||
return $cookieDomain == $host
|
||||
|| preg_match('/' . preg_quote($cookieDomain) . '$/', $host);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,7 +660,7 @@ class SetCookie implements MultipleHeaderInterface
|
||||
$headerLine = $this->toString();
|
||||
/* @var $header SetCookie */
|
||||
foreach ($headers as $header) {
|
||||
if (!$header instanceof SetCookie) {
|
||||
if (! $header instanceof SetCookie) {
|
||||
throw new Exception\RuntimeException(
|
||||
'The SetCookie multiple header implementation can only accept an array of SetCookie headers'
|
||||
);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class Trailer implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -17,7 +15,7 @@ class TransferEncoding implements HeaderInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public static function fromString($headerLine)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
@@ -65,7 +63,7 @@ class WWWAuthenticate implements MultipleHeaderInterface
|
||||
{
|
||||
$strings = [$this->toString()];
|
||||
foreach ($headers as $header) {
|
||||
if (!$header instanceof WWWAuthenticate) {
|
||||
if (! $header instanceof WWWAuthenticate) {
|
||||
throw new Exception\RuntimeException(
|
||||
'The WWWAuthenticate multiple header implementation can only'
|
||||
. ' accept an array of WWWAuthenticate headers'
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @see https://github.com/zendframework/zend-http for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Http\Header;
|
||||
|
||||
Reference in New Issue
Block a user