class Inline

Inline implements a YAML parser/dumper for the YAML inline syntax.

Constants

REGEX_QUOTED_STRING

Methods

static mixed
parse(string $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false, bool $objectForMap = false, array $references = array())

Converts a YAML string to a PHP value.

static string
dump(mixed $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false)

Dumps a given PHP variable to a YAML string.

static bool
isHash(array $value)

Check if given array is hash or just normal indexed array.

static string
parseScalar(string $scalar, string[] $delimiters = null, string[] $stringDelimiters = array('"', "'"), int $i = 0, bool $evaluate = true, array $references = array())

Parses a YAML scalar.

Details

at line 43
static mixed parse(string $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false, bool $objectForMap = false, array $references = array())

Converts a YAML string to a PHP value.

Parameters

string $value A YAML string
bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
bool $objectSupport True if object support is enabled, false otherwise
bool $objectForMap True if maps should return a stdClass instead of array()
array $references Mapping of variable names to values

Return Value

mixed A PHP value

Exceptions

ParseException

at line 97
static string dump(mixed $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false)

Dumps a given PHP variable to a YAML string.

Parameters

mixed $value The PHP variable to convert
bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
bool $objectSupport True if object support is enabled, false otherwise

Return Value

string The YAML string representing the PHP value

Exceptions

DumpException When trying to dump PHP resource

at line 169
static bool isHash(array $value)

Check if given array is hash or just normal indexed array.

Parameters

array $value The PHP array to check

Return Value

bool true if value is hash array, false otherwise

at line 228
static string parseScalar(string $scalar, string[] $delimiters = null, string[] $stringDelimiters = array('"', "'"), int $i = 0, bool $evaluate = true, array $references = array())

Parses a YAML scalar.

Parameters

string $scalar
string[] $delimiters
string[] $stringDelimiters
int $i &$i
bool $evaluate
array $references

Return Value

string

Exceptions

ParseException When malformed inline YAML string is parsed