HumHub Documentation (unofficial)

ContentType
in package
implements HeaderInterface

Tags
see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
throws
InvalidArgumentException

Table of Contents

Interfaces

HeaderInterface
Interface for HTTP Header classes.

Properties

$mediaType  : string
$parameters  : array<string|int, mixed>
$value  : string

Methods

__construct()  : mixed
fromString()  : static
Factory method: create an object from a string representation
getCharset()  : null|string
Get the content-type character set encoding, if any
getFieldName()  : string
Get the field name
getFieldValue()  : string
Get the field value
getMediaType()  : string
Get the media type
getParameters()  : array<string|int, mixed>
Get any additional content-type parameters currently set
match()  : string|bool
Determine if the mediatype value in this header matches the provided criteria
setCharset()  : $this
Set the content-type character set encoding
setMediaType()  : $this
Set the media type
setParameters()  : $this
Set additional content-type parameters
toString()  : string
Create a string representation of the header
assembleValue()  : string
Assemble the value based on the media type and any available parameters
getMediaTypeObjectFromString()  : stdClass
Split a mediatype string into an object with the following parts:
splitMediaTypesFromString()  : array<string|int, mixed>
Split comma-separated media types into an array
validateFormat()  : bool
Validate the format
validatePartialWildcard()  : bool
Validate a partial wildcard (i.e., string ending in '*')
validateSubtype()  : bool
Validate a subtype

Properties

$parameters

protected array<string|int, mixed> $parameters = []

Methods

__construct()

public __construct([null|string $value = null ][, null|string $mediaType = null ]) : mixed
Parameters
$value : null|string = null
$mediaType : null|string = null

fromString()

Factory method: create an object from a string representation

public static fromString(string $headerLine) : static
Parameters
$headerLine : string
Return values
static

getCharset()

Get the content-type character set encoding, if any

public getCharset() : null|string
Return values
null|string

getFieldName()

Get the field name

public getFieldName() : string
Return values
string

getFieldValue()

Get the field value

public getFieldValue() : string
Return values
string

getMediaType()

Get the media type

public getMediaType() : string
Return values
string

getParameters()

Get any additional content-type parameters currently set

public getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

match()

Determine if the mediatype value in this header matches the provided criteria

public match(array<string|int, mixed>|string $matchAgainst) : string|bool
Parameters
$matchAgainst : array<string|int, mixed>|string
Return values
string|bool

Matched value or false

setCharset()

Set the content-type character set encoding

public setCharset(string $charset) : $this
Parameters
$charset : string
Return values
$this

setMediaType()

Set the media type

public setMediaType(string $mediaType) : $this
Parameters
$mediaType : string
Return values
$this

setParameters()

Set additional content-type parameters

public setParameters(array<string|int, mixed> $parameters) : $this
Parameters
$parameters : array<string|int, mixed>
Return values
$this

toString()

Create a string representation of the header

public toString() : string
Return values
string

assembleValue()

Assemble the value based on the media type and any available parameters

protected assembleValue() : string
Return values
string

getMediaTypeObjectFromString()

Split a mediatype string into an object with the following parts:

protected getMediaTypeObjectFromString(string $string) : stdClass
  • type
  • subtype
  • format
Parameters
$string : string
Return values
stdClass

splitMediaTypesFromString()

Split comma-separated media types into an array

protected splitMediaTypesFromString(string $criteria) : array<string|int, mixed>
Parameters
$criteria : string
Return values
array<string|int, mixed>

validateFormat()

Validate the format

protected validateFormat(string $right, string $left) : bool

Validate that the right side format matches what the left side defines.

Parameters
$right : string
$left : string
Return values
bool

validatePartialWildcard()

Validate a partial wildcard (i.e., string ending in '*')

protected validatePartialWildcard(string $right, string $left) : bool
Parameters
$right : string
$left : string
Return values
bool

validateSubtype()

Validate a subtype

protected validateSubtype(stdClass $right, stdClass $left) : bool
Parameters
$right : stdClass
$left : stdClass
Return values
bool

        
On this page

Search results