trait ContentNegotiationTrait

Basic content negotiation.

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 27
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 44
protected bool expectsJson()

Does the client expect JSON?

Return Value

bool

at line 54
protected bool expectsXml()

Does the client expect XML?

Return Value

bool

at line 66
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 83
protected bool respondWithJson()

Should we respond with JSON?

Return Value

bool

at line 93
protected bool respondWithXml()

Should we respond with XML?

Return Value

bool