Class Horde_Yaml
Horde YAML parser.
This class can be used to read a YAML file and convert its contents
into a PHP array. The native PHP parser supports a limited
subsection of the YAML spec, but if the syck extension is present,
that will be used for parsing.
Methods summary
public static
array
|
#
load( string $yaml )
Load a string containing YAML and parse it into a PHP array.
Returns an empty array on failure.
Load a string containing YAML and parse it into a PHP array.
Returns an empty array on failure.
Parameters
- $yaml
- String containing YAML
Returns
array PHP array representation of YAML content
|
public static
array
|
#
loadFile( string $filename )
Load a file containing YAML and parse it into a PHP array.
Load a file containing YAML and parse it into a PHP array.
If the file cannot be opened, an exception is thrown. If the
file is read but parsing fails, an empty array is returned.
Parameters
- $filename
- Filename to load
Returns
array PHP array representation of YAML content
Throws
|
public static
array
|
#
loadStream( resource $stream )
Load YAML from a PHP stream resource.
Load YAML from a PHP stream resource.
Parameters
- $stream
- PHP stream resource
Returns
array PHP array representation of YAML content
|
public static
string
|
#
dump( array|Traversable $value, integer $options = array() )
Dump a PHP array to YAML.
Dump a PHP array to YAML.
The dump method, when supplied with an array, will do its best
to convert the array into friendly YAML.
Parameters
- $value
- $array PHP array or traversable object
- $options
- Options to pass to dumper
Returns
string YAML representation of $value
|
Properties summary
public static
callable
|
$loadfunc
Callback used for alternate YAML loader, typically exported
by a faster PHP extension. This function's first argument
must accept a string with YAML content.
Callback used for alternate YAML loader, typically exported
by a faster PHP extension. This function's first argument
must accept a string with YAML content.
|
|
public static
callable
|
$dumpfunc
Callback used for alternate YAML dumper, typically exported
by a faster PHP extension. This function's first argument
must accept a mixed variable to be dumped.
Callback used for alternate YAML dumper, typically exported
by a faster PHP extension. This function's first argument
must accept a mixed variable to be dumped.
|
|
public static
array
|
$allowedClasses
Whitelist of classes that can be instantiated automatically
when loading YAML docs that include serialized PHP objects.
Whitelist of classes that can be instantiated automatically
when loading YAML docs that include serialized PHP objects.
|
|