Class Negotiate

Summary

Fully Qualified Name: CodeIgniter\HTTP\Negotiate

Description

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.

Methods

Name Description Defined By
__construct() Constructor Negotiate
charset() Determines the best charset to use based on the $supported types the application says it supports, and the types requested by the client. Negotiate
encoding() Determines the best encoding type to use based on the $supported types the application says it supports, and the types requested by the client. Negotiate
language() Determines the best language to use based on the $supported types the application says it supports, and the types requested by the client. Negotiate
matchLocales() Will match locales against their broader pairs, so that fr-FR would match a supported localed of fr Negotiate
matchTypes() Compares the types/subtypes of an acceptable Media type and the supported string. Negotiate
media() Determines the best content-type to use based on the $supported types the application says it supports, and the types requested by the client. Negotiate
parseHeader() Parses an Accept* header into it's multiple values. Negotiate
setRequest() Stores the request instance to grab the headers from. Negotiate

Method Details

__construct()

Constructor

Parameter Name Type Description
$request \CodeIgniter\HTTP\RequestInterface

Returns:

charset()

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.

Parameter Name Type Description
$supported array

Returns: string

encoding()

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.

Parameter Name Type Description
$supported array

Returns: string

language()

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.

Parameter Name Type Description
$supported array

Returns: string

matchLocales()

Will match locales against their broader pairs, so that fr-FR would match a supported localed of fr

Parameter Name Type Description
$acceptable array
$supported array

Returns: bool

matchTypes()

Compares the types/subtypes of an acceptable Media type and the supported string.

Parameter Name Type Description
$acceptable array
$supported array

Returns: bool

media()

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.

Parameter Name Type Description
$supported array
$strictMatch bool If

Returns: string

parseHeader()

Parses an Accept* header into it's multiple values.

This is based on code from Aura.Accept library.

Parameter Name Type Description
$header string

Returns: array

setRequest()

Stores the request instance to grab the headers from.

Parameter Name Type Description
$request \RequestInterface

Returns: $this

Top