UserFrosting API

DeterminesContentType

Trait for classes that need to determine a request's accepted content type(s).

Tags
author

Alex Weissman (https://alexanderweissman.com)

Table of Contents

$knownContentTypes Known handled content types. array
determineContentType() Determine which content type we know about is wanted using Accept header. string

Properties

$knownContentTypes

Known handled content types.

protected array $knownContentTypes = ['application/json', 'application/xml', 'text/xml', 'text/html', 'text/plain']

Methods

determineContentType()

Determine which content type we know about is wanted using Accept header.

protected determineContentType( $request : ServerRequestInterface [, $ajaxDebug : bool = false ] ) : string

Note: This method is a bare-bones implementation designed specifically for Slim's error handling requirements. Consider a fully-feature solution such as willdurand/negotiation for any other situation.

Parameters
$request : ServerRequestInterface
$ajaxDebug : bool = false
Return values
string

Search results