trait ContentNegotiationTrait

Basic content negotiation.

Properties

Request $request
Response $response

Methods

bool
expectsType(array $mimeTypes, string|null $suffix = null)

Does the client expect the provided mime type?

bool
expectsJson()

Does the client expect JSON?

bool
expectsXml()

Does the client expect XML?

bool
respondWithType(array $mimeTypes, string|null $suffix = null)

Should we respond with the provided mime type?

bool
respondWithJson()

Should we respond with JSON?

bool
respondWithXml()

Should we respond with XML?

Details

at line 28
protected bool expectsType(array $mimeTypes, string|null $suffix = null)

Does the client expect the provided mime type?

Parameters

array $mimeTypes Mime types
string|null $suffix Mime type suffix

Return Value

bool

at line 45
protected bool expectsJson()

Does the client expect JSON?

Return Value

bool

at line 55
protected bool expectsXml()

Does the client expect XML?

Return Value

bool

at line 67
protected bool respondWithType(array $mimeTypes, string|null $suffix = null)

Should we respond with the provided mime type?

Parameters

array $mimeTypes Mime types
string|null $suffix Mime type suffix

Return Value

bool

at line 84
protected bool respondWithJson()

Should we respond with JSON?

Return Value

bool

at line 94
protected bool respondWithXml()

Should we respond with XML?

Return Value

bool