19 class AcceptHeaderItem
22 private $quality = 1.0;
24 private $attributes = [];
26 public function __construct(
string $value, array $attributes = [])
28 $this->value = $value;
29 foreach ($attributes as $name => $value) {
45 $part = array_shift($parts);
48 return new self($part[0], $attributes);
58 $string = $this->value.($this->quality < 1 ?
';q='.$this->quality :
'');
59 if (\count($this->attributes) > 0) {
60 $string .=
'; '.HeaderUtils::toString($this->attributes,
';');
75 $this->value = $value;
99 $this->quality = $quality;
111 return $this->quality;
123 $this->index = $index;
147 return isset($this->attributes[$name]);
160 return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
170 return $this->attributes;
184 $this->quality = (float) $value;
186 $this->attributes[$name] = (string) $value;