neoncitylights/php-media-type

MediaType implements Stringable

FinalYes
Tags
see
https://tools.ietf.org/html/rfc2045
see
https://mimesniff.spec.whatwg.org/
license

MIT

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

Methods

__construct()

public __construct(string $type, string $subType, array<string|int, string> $parameters) : mixed
Parameters
$type : string
$subType : string
$parameters : array<string|int, string>

getParameterValue()

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|null

serializeParameterValue()

private serializeParameterValue(string $value) : string
Parameters
$value : string
Return values
string

subtypeMatchesOneOf()

private subtypeMatchesOneOf(array<string|int, string> $subTypes) : mixed
Parameters
$subTypes : array<string|int, string>

        
On this page

Search results