Propel API
Class

sfYaml

class sfYaml

sfYaml offers convenience methods to load and dump YAML.

Methods

static  setSpecVersion(string $version)

Sets the YAML specification version to use.

static string getSpecVersion()

Gets the YAML specification version to use.

static array load(string $input)

Loads YAML into a PHP array.

static string dump(array $array, integer $inline = 2)

Dumps a PHP array to a YAML string.

Details

at line 29
static public setSpecVersion(string $version)

Sets the YAML specification version to use.

Parameters

string $version The YAML specification version

at line 44
static public string getSpecVersion()

Gets the YAML specification version to use.

Return Value

string The YAML specification version

at line 67
static public array load(string $input)

Loads YAML into a PHP array.

The load method, when supplied with a YAML stream (string or file),
will do its best to convert YAML in a file into a PHP array.

Usage:
<code>
$array = sfYaml::load('config.yml');
print_r($array);
</code>

Parameters

string $input Path of YAML file or string containing YAML

Return Value

array The YAML converted to a PHP array

Exceptions

InvalidArgumentException If the YAML is not valid

at line 117
static public string dump(array $array, integer $inline = 2)

Dumps a PHP array to a YAML string.

The dump method, when supplied with an array, will do its best
to convert the array into friendly YAML.

Parameters

array $array PHP array
integer $inline The level where you switch to inline YAML

Return Value

string A YAML string representing the original PHP array