MediaType
in package
implements
Stringable
FinalYes
Tags
Table of Contents
Interfaces
- Stringable
Properties
- $parameters : array<string|int, string>
- Gives an array of parameters of a media type, if any parameters exist. Otherwise, it will return an empty array.
- $subType : string
- Gives the second portion of a media type's essence.
- $type : string
- Gives the first portion of a media type's essence.
Methods
- __construct() : mixed
- __toString() : string
- getEssence() : string
- Gives the type and subtype of a media type.
- getParameterValue() : string|null
- Gives the value of a specified parameter of a media type, if that parameter exists; otherwise, it will return a null value.
- isArchive() : bool
- isAudioOrVideo() : bool
- isFont() : bool
- isHtml() : bool
- isImage() : bool
- isJavaScript() : bool
- isJson() : bool
- isScriptable() : bool
- isXml() : bool
- isZipBased() : bool
- minimize() : string
- serializeParameterValue() : string
- subtypeMatchesOneOf() : mixed
Properties
$parameters read-only
Gives an array of parameters of a media type, if any parameters exist. Otherwise, it will return an empty array.
public
array<string|int, string>
$parameters
Tags
$subType read-only
Gives the second portion of a media type's essence.
public
string
$subType
e.g, if given 'text/plain', it will return 'plain'.
Tags
$type read-only
Gives the first portion of a media type's essence.
public
string
$type
e.g, if given 'text/plain', it will return 'text'.
Tags
Methods
__construct()
public
__construct(string $type, string $subType, array<string|int, string> $parameters) : mixed
Parameters
- $type : string
- $subType : string
- $parameters : array<string|int, string>
__toString()
public
__toString() : string
Tags
Return values
stringgetEssence()
Gives the type and subtype of a media type.
public
getEssence() : string
e.g, if given 'text/plain;charset=UTF-8', it will return 'text/plain'.
Tags
Return values
stringgetParameterValue()
Gives the value of a specified parameter of a media type, if that parameter exists; otherwise, it will return a null value.
public
getParameterValue(string $parameterName) : string|null
e.g, if given a media type of 'text/plain;charset=UTF-8', and the given parameter is 'charset', it will return 'UTF-8'.
Parameters
- $parameterName : string
Return values
string|nullisArchive()
public
isArchive() : bool
Tags
Return values
boolisAudioOrVideo()
public
isAudioOrVideo() : bool
Tags
Return values
boolisFont()
public
isFont() : bool
Tags
Return values
boolisHtml()
public
isHtml() : bool
Tags
Return values
boolisImage()
public
isImage() : bool
Tags
Return values
boolisJavaScript()
public
isJavaScript() : bool
Tags
Return values
boolisJson()
public
isJson() : bool
Tags
Return values
boolisScriptable()
public
isScriptable() : bool
Tags
Return values
boolisXml()
public
isXml() : bool
Tags
Return values
boolisZipBased()
public
isZipBased() : bool
Tags
Return values
boolminimize()
public
minimize(bool $isSupported) : string
Parameters
- $isSupported : bool
Tags
Return values
stringserializeParameterValue()
private
serializeParameterValue(string $value) : string
Parameters
- $value : string
Return values
stringsubtypeMatchesOneOf()
private
subtypeMatchesOneOf(array<string|int, string> $subTypes) : mixed
Parameters
- $subTypes : array<string|int, string>