You are here

public function AcceptHeaderItem::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/AcceptHeaderItem.php \Symfony\Component\HttpFoundation\AcceptHeaderItem::__toString()

Returns header value's string representation.

Return value

string

File

vendor/symfony/http-foundation/AcceptHeaderItem.php, line 89

Class

AcceptHeaderItem
Represents an Accept-* header item.

Namespace

Symfony\Component\HttpFoundation

Code

public function __toString() {
  $string = $this->value . ($this->quality < 1 ? ';q=' . $this->quality : '');
  if (count($this->attributes) > 0) {
    $string .= ';' . implode(';', array_map(function ($name, $value) {
      return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value);
    }, array_keys($this->attributes), $this->attributes));
  }
  return $string;
}