Skip to content

Commit

Permalink
Add Request::getAccept()
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Dec 12, 2017
1 parent 8693952 commit 4eeaae2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,20 @@ public function setClientIp(string $ip) : Request
return $this;
}

/**
* Returns the content types accepted by the client.
*
* This method parses the Accept header,
* and returns an associative array where keys are language tags,
* and values are the associated weights in the range [0-1]. Highest weights are returned first.
*
* @return array The accepted languages.
*/
public function getAccept() : array
{
return $this->parseQualityValues($this->getHeader('Accept'));
}

/**
* Returns the languages accepted by the client.
*
Expand Down

0 comments on commit 4eeaae2

Please sign in to comment.