upgraded dependencies
This commit is contained in:
@@ -34,13 +34,11 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Builds an AcceptHeaderInstance instance from a string.
|
||||
*
|
||||
* @param string $itemValue
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromString($itemValue)
|
||||
public static function fromString(?string $itemValue)
|
||||
{
|
||||
$parts = HeaderUtils::split($itemValue, ';=');
|
||||
$parts = HeaderUtils::split($itemValue ?? '', ';=');
|
||||
|
||||
$part = array_shift($parts);
|
||||
$attributes = HeaderUtils::combine($parts);
|
||||
@@ -66,11 +64,9 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Set the item value.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
public function setValue(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
@@ -90,11 +86,9 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Set the item quality.
|
||||
*
|
||||
* @param float $quality
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setQuality($quality)
|
||||
public function setQuality(float $quality)
|
||||
{
|
||||
$this->quality = $quality;
|
||||
|
||||
@@ -114,11 +108,9 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Set the item index.
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIndex($index)
|
||||
public function setIndex(int $index)
|
||||
{
|
||||
$this->index = $index;
|
||||
|
||||
@@ -138,11 +130,9 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Tests if an attribute exists.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAttribute($name)
|
||||
public function hasAttribute(string $name)
|
||||
{
|
||||
return isset($this->attributes[$name]);
|
||||
}
|
||||
@@ -150,12 +140,11 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Returns an attribute by its name.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute($name, $default = null)
|
||||
public function getAttribute(string $name, $default = null)
|
||||
{
|
||||
return $this->attributes[$name] ?? $default;
|
||||
}
|
||||
@@ -173,17 +162,14 @@ class AcceptHeaderItem
|
||||
/**
|
||||
* Set an attribute.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttribute($name, $value)
|
||||
public function setAttribute(string $name, string $value)
|
||||
{
|
||||
if ('q' === $name) {
|
||||
$this->quality = (float) $value;
|
||||
} else {
|
||||
$this->attributes[$name] = (string) $value;
|
||||
$this->attributes[$name] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Reference in New Issue
Block a user