Zend Framework  3.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ContentType Class Reference

Public Member Functions

 __construct ($value=null, $mediaType=null)
 
 match ($matchAgainst)
 Determine if the mediatype value in this header matches the provided criteria.
 
 toString ()
 Create a string representation of the header.
 
 getFieldName ()
 Get the field name.
 
 getFieldValue ()
 Get the field value.
 
 setMediaType ($mediaType)
 Set the media type.
 
 getMediaType ()
 Get the media type.
 
 setParameters (array $parameters)
 Set additional content-type parameters.
 
 getParameters ()
 Get any additional content-type parameters currently set.
 
 setCharset ($charset)
 Set the content-type character set encoding.
 
 getCharset ()
 Get the content-type character set encoding, if any.
 

Static Public Member Functions

static fromString ($headerLine)
 Factory method: create an object from a string representation.
 

Protected Member Functions

 assembleValue ()
 Assemble the value based on the media type and any available parameters.
 
 splitMediaTypesFromString ($criteria)
 Split comma-separated media types into an array.
 
 getMediaTypeObjectFromString ($string)
 Split a mediatype string into an object with the following parts:
 
 validateSubtype ($right, $left)
 Validate a subtype.
 
 validateFormat ($right, $left)
 Validate the format.
 
 validatePartialWildcard ($right, $left)
 Validate a partial wildcard (i.e., string ending in '*')
 

Protected Attributes

 $mediaType
 
 $parameters = []
 
 $value
 

Detailed Description

Exceptions
Exception\InvalidArgumentException
See Also
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17

Constructor & Destructor Documentation

__construct (   $value = null,
  $mediaType = null 
)

Member Function Documentation

assembleValue ( )
protected

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

Returns
string
static fromString (   $headerLine)
static

Factory method: create an object from a string representation.

Parameters
string$headerLine
Returns
self

Implements HeaderInterface.

getCharset ( )

Get the content-type character set encoding, if any.

Returns
null|string
getFieldName ( )

Get the field name.

Returns
string

Implements HeaderInterface.

getFieldValue ( )

Get the field value.

Returns
string

Implements HeaderInterface.

getMediaType ( )

Get the media type.

Returns
string
getMediaTypeObjectFromString (   $string)
protected

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

  • type
  • subtype
  • format
Parameters
string$string
Returns
stdClass
getParameters ( )

Get any additional content-type parameters currently set.

Returns
array
match (   $matchAgainst)

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

Parameters
array | string$matchAgainst
Returns
string|bool Matched value or false
setCharset (   $charset)

Set the content-type character set encoding.

Parameters
string$charset
Returns
self
setMediaType (   $mediaType)

Set the media type.

Parameters
string$mediaType
Returns
self
setParameters ( array  $parameters)

Set additional content-type parameters.

Parameters
array$parameters
Returns
self
splitMediaTypesFromString (   $criteria)
protected

Split comma-separated media types into an array.

Parameters
string$criteria
Returns
array
toString ( )

Create a string representation of the header.

Returns
string

Implements HeaderInterface.

validateFormat (   $right,
  $left 
)
protected

Validate the format.

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

Parameters
string$right
string$left
Returns
bool
validatePartialWildcard (   $right,
  $left 
)
protected

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

Parameters
string$right
string$left
Returns
bool
validateSubtype (   $right,
  $left 
)
protected

Validate a subtype.

Parameters
stdClass$right
stdClass$left
Returns
bool

Member Data Documentation

$mediaType
protected
$parameters = []
protected
$value
protected