This method may work different then you might think. This is a _convenience_ method
working exclusively with short type names it knows about. Only those types will be
matched. You can tell this method about more types via Media::type().
Note: In case negotiation fails, 'html' is used as a fallback type.
public accepts ( boolean | string $type = null ) : string | boolean | array | ||
$type | boolean | string | Optionally a type name i.e. `'json'` or `true`. 1. If not specified, returns the media type name that the client prefers, using a potentially set `type` param, then content negotiation and that fails, ultimately falling back and returning the string `'html'`. 2. If a media type name (string) is passed, returns `true` or `false`, indicating whether or not that type is accepted by the client at all. 3. If `true`, returns the raw content types from the `Accept` header, parsed into an array and sorted by client preference. |
return | string | boolean | array | Returns a type name (i.e. 'json'`) or a boolean or an array, depending on the value of `$type`. |