initialize
[mdref/mdref-http] / http / Header / negotiate.md
1 # string http\Header::negotiate(array $supported[, array &$result])
2
3 Negotiate the header's value against a list of supported values in $supported.
4 Negotiation operation is adopted according to the header name, i.e. if the
5 header being negotiated is ```Accept```, then a slash is used as primary type
6 separator, and if the header is ```Accept-Language``` respectively, a hyphen is
7 used instead.
8
9 > ***NOTE:*** The first elemement of $supported serves as a default if no operand matches.
10
11 ## Params:
12
13 * ```array $supported```
14 The list of supported values to negotiate.
15 * Optional reference ```array &$result```
16 Out parameter recording the negotiation results.
17
18 ## Returns:
19
20 * ```NULL```, if negotiation fails.
21 * ```string```, the closest match negotiated, or the default (first entry of $supported).