interface MediaTypeInterface implements ParameterMapProviderInterface, StringRepresentation, JsonSerializable (View source)

Media Type / Media Range interface

  • String representation must return the Media Type/Range without parameters
  • Serialized form MUST return the media type / range followed by a semicolon-separated list of parameters
  • media-type = type "/" sub-type serialized = media-type 0*(";" parameter) parameter = token "=" ( token / quoted )

Constants

ANY

Wildcard type or subtype

Methods

true
match(MediaTypeInterface|string $mediaRange)

Check if the MediaType instance match the given MediaRange

string
getType()

Get media type main type

MediaSubType|string
getSubType()

Get media type sub type and optional structured syntax suffix

string|array|string|NULL
getStructuredSyntax(boolean $registeredOnly = false)

Get the subtype structured syntax name if any.

Details

true match(MediaTypeInterface|string $mediaRange)

Check if the MediaType instance match the given MediaRange

Parameters

MediaTypeInterface|string $mediaRange

Return Value

true if $mediaRange is identical or less restrictive than $this

string getType()

Get media type main type

Any RFC 6838 restricted name token or the wildcard token "*"

Return Value

string

MediaSubType|string getSubType()

Get media type sub type and optional structured syntax suffix

Any of the following

  • A RFC 6838 restricted name token, optionnaly followed by a "+" and a structured syntax suffix
  • The wildcard token.

Return Value

MediaSubType|string

string|array|string|NULL getStructuredSyntax(boolean $registeredOnly = false)

Get the subtype structured syntax name if any.

Parameters

boolean $registeredOnly When the structured syntax suffix is not present. The subtype may be returned. If $registeredOnly is true. Only the subtype will be returned only if it correspond to a registered suffix.

Return Value

string|array|string|NULL