$request
$request : \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\IncomingRequest
Request
Class Negotiate
Provides methods to negotiate with the HTTP headers to determine the best type match between what the application supports and what the requesting getServer wants.
$request : \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\IncomingRequest
Request
__construct(\CodeIgniter\HTTP\RequestInterface $request = null)
Constructor
\CodeIgniter\HTTP\RequestInterface | $request |
setRequest(\CodeIgniter\HTTP\RequestInterface $request) : $this
Stores the request instance to grab the headers from.
\CodeIgniter\HTTP\RequestInterface | $request |
media(array $supported, boolean $strictMatch = false) : string
Determines the best content-type to use based on the $supported types the application says it supports, and the types requested by the client.
If no match is found, the first, highest-ranking client requested type is returned.
array | $supported | |
boolean | $strictMatch | If TRUE, will return an empty string when no match found. If FALSE, will return the first supported element. |
charset(array $supported) : string
Determines the best charset to use based on the $supported types the application says it supports, and the types requested by the client.
If no match is found, the first, highest-ranking client requested type is returned.
array | $supported |
encoding(array $supported = array()) : string
Determines the best encoding type to use based on the $supported types the application says it supports, and the types requested by the client.
If no match is found, the first, highest-ranking client requested type is returned.
array | $supported |
language(array $supported) : string
Determines the best language to use based on the $supported types the application says it supports, and the types requested by the client.
If no match is found, the first, highest-ranking client requested type is returned.
array | $supported |
getBestMatch(array $supported, string $header = null, boolean $enforceTypes = false, boolean $strictMatch = false) : string
Does the grunt work of comparing any of the app-supported values against a given Accept* header string.
Portions of this code base on Aura.Accept library.
array | $supported | App-supported values |
string | $header | header string |
boolean | $enforceTypes | If TRUE, will compare media types and sub-types. |
boolean | $strictMatch | If TRUE, will return empty string on no match. If FALSE, will return the first supported element. |
Best match
Loading…