Copied!

ParsingDispatcher

ParsingDispatcher.php : 17

Parsing dispatcher.

Properties

protected $eventDispatcher

ParsingDispatcher.php : 37
protected EventDispatcherInterface $eventDispatcher

protected $parsers

ParsingDispatcher.php : 35

Array of parsers.

protected array<string, array<string, Parser>> $parsers = []

Structure:

array( => array( => , … } )

Methods

public__construct()

ParsingDispatcher.php : 42

Construct from optional parsers array.

public __construct(EventDispatcherInterface $eventDispatcher[, array<string|int, mixed> $parsers = [] ])

Parameters

Name Type Default value Description
$eventDispatcher EventDispatcherInterface - -
$parsers array<string|int, mixed> [] -

publicaddParser()

ParsingDispatcher.php : 57

Adds another parser for the given content type.

public addParser(string $mediaType, Parser $parser) : void

Parameters

Name Type Default value Description
$mediaType string - -
$parser Parser - -

publicparse()

ParsingDispatcher.php : 67

Dispatches parsing the given $data according to $mediaType.

public parse(array<string|int, mixed> $data, string $mediaType) : mixed

Parameters

Name Type Default value Description
$data array<string|int, mixed> - -
$mediaType string - -

protectedinternalParse()

ParsingDispatcher.php : 98

Parses the given $data according to $mediaType.

protected internalParse(array<string|int, mixed> $data, string $mediaType) : mixed

Parameters

Name Type Default value Description
$data array<string|int, mixed> - -
$mediaType string - -

protectedparseMediaTypeVersion()

ParsingDispatcher.php : 121

Parses and returns the version from a MediaType.

protected parseMediaTypeVersion(string $mediaType) : array{: string, : string}

Parameters

Name Type Default value Description
$mediaType string -

Ex: text/html; version=1.1

Return values

array{: string, : string}

An array with the media-type string, stripped from the version, and the version (1.0 by default)