class StructuredText (View source)

deprecated Use ns-php-data DataSerializationManager

Structured syntax text utility

Constants

FORMAT_INI

IIN file format

FORMAT_JSON

JSON

FORMAT_URL_ENCODED

URL encoded data

FORMAT_XML

XML DOM

FORMAT_YAML

YAML document

STRUCTURED_SYNTAX_SUFFIX_PATTERN

RFC 6838 Media type structured syntax suffix pattern.

Methods

static array
parseFile(string $filename, string|null $mediaType = null)

No description

static mixed
parseText(string $text, string $format)

No description

static string|false
mediaTypeFormat(string $mediaType)

Find the structured text format from the given media type.

static array|string|false
formatMediaType(string $format, boolean $allAlternatives = false)

No description

Details

static array parseFile(string $filename, string|null $mediaType = null)

Parameters

string $filename
string|null $mediaType File media type. If null, the media type is guessed from file content.

Return Value

array

Exceptions

InvalidArgumentException
TypeConversionException

static mixed parseText(string $text, string $format)

Parameters

string $text Structured text
string $format Text format

Return Value

mixed

Exceptions

TypeConversionException

static string|false mediaTypeFormat(string $mediaType)

Find the structured text format from the given media type.

Parameters

string $mediaType

Return Value

string|false

static array|string|false formatMediaType(string $format, boolean $allAlternatives = false)

Parameters

string $format Structured text format
boolean $allAlternatives If true, returns all possible media types.

Return Value

array|string|false