PHP Class eZ\Publish\Core\REST\Common\Input\ParsingDispatcher

Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$parsers Parser[] Structure: array( => array( => , … } )

Public Methods

Method Description
__construct ( array $parsers = [] ) Construct from optional parsers array.
addParser ( string $mediaType, Parser $parser ) Adds another parser for the given Content Type.
parse ( array $data, string $mediaType ) : eZ\Publish\API\Repository\Values\ValueObject Parses the given $data according to $mediaType.

Protected Methods

Method Description
parseMediaTypeVersion ( string $mediaType ) : string Parses and returns the version from a MediaType.

Method Details

__construct() public method

Construct from optional parsers array.
public __construct ( array $parsers = [] )
$parsers array

addParser() public method

Adds another parser for the given Content Type.
public addParser ( string $mediaType, Parser $parser )
$mediaType string
$parser Parser

parse() public method

Parses the given $data according to $mediaType.
public parse ( array $data, string $mediaType ) : eZ\Publish\API\Repository\Values\ValueObject
$data array
$mediaType string
return eZ\Publish\API\Repository\Values\ValueObject

parseMediaTypeVersion() protected method

Parses and returns the version from a MediaType.
protected parseMediaTypeVersion ( string $mediaType ) : string
$mediaType string Ex: text/html; version=1.1
return string An array with the mediatype string, stripped from the version, and the version (1.0 by default)

Property Details

$parsers protected property

Structure: array( => array( => , … } )
protected Parser[],eZ\Publish\Core\REST\Common\Input $parsers
return Parser[]