class MediaSubType implements StringRepresentation, ComparableInterface (View source)

Media sub type

Methods

__construct(array|string $facets, string|null $structuredSyntax = null)

No description

__toString()

No description

array
getFacets()

No description

string|NULL
getFacet(integer $index)

No description

integer
getFacetCount()

No description

string
getStructuredSyntax()

Get the sub type structured syntax name

compare(MediaSubType|MediaTypeInterface|string $b)

Compare sub type precision with another

Details

__construct(array|string $facets, string|null $structuredSyntax = null)

Parameters

array|string $facets
string|null $structuredSyntax

__toString()

array getFacets()

Return Value

array Subtype facets

string|NULL getFacet(integer $index)

Parameters

integer $index

Return Value

string|NULL Subtype facet at the given index or null if the index does not exists

integer getFacetCount()

Return Value

integer Number of sub type facets

string getStructuredSyntax()

Get the sub type structured syntax name

Return Value

string If any, the lower-case structured syntax name

See also

https://tools.ietf.org/html/rfc6838#section-4.2.8

compare(MediaSubType|MediaTypeInterface|string $b)

Compare sub type precision with another

A sub type {a} is more precise than another sub type {b} if - {a} has at least one facet and {b} is empty - All facets of {b} are identical to the first facets of {a} and {a} has more facets than {b} - A NotComparableException is thrown if a facet of {a} does not match the facet of {b} at the same position.

Parameters

MediaSubType|MediaTypeInterface|string $b Media sub type to compare with

Return Value

if sub types are identical, < 0 if $this is less precise than $b, and > 0 if $this is more precise than $b

Exceptions

NotComparableException