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 30
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 47
protected bool expectsJson()

Does the client expect JSON?

Return Value

bool

at line 57
protected bool expectsXml()

Does the client expect XML?

Return Value

bool

at line 69
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 86
protected bool respondWithJson()

Should we respond with JSON?

Return Value

bool

at line 96
protected bool respondWithXml()

Should we respond with XML?

Return Value

bool