Class Horde_Yaml

Description

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.

Located in /Yaml/lib/Horde/Yaml.php (line 28)


	
			
Variable Summary
 static array $allowedClasses
 static callback $dumpfunc
 static callback $loadfunc
Method Summary
 static string dump ( $value, [integer $options = array()], array|Traversable $array)
 static array load (string $yaml)
 static array loadFile (string $filename)
 static array loadStream (resource $stream)
Variables
static array $allowedClasses = array('ArrayObject') (line 54)

Whitelist of classes that can be instantiated automatically when loading YAML docs that include serialized PHP objects.

  • access: public
static callback $dumpfunc = 'syck_dump' (line 46)

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.

  • access: public
static callback $loadfunc = 'syck_load' (line 37)

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.

  • access: public
Methods
static dump (line 148)

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.

  • return: YAML representation of $value
  • access: public
static string dump ( $value, [integer $options = array()], array|Traversable $array)
  • array|Traversable $array: PHP array or traversable object
  • integer $options: Options to pass to dumper
  • $value
static load (line 63)

Load a string containing YAML and parse it into a PHP array.

Returns an empty array on failure.

  • return: PHP array representation of YAML content
  • access: public
static array load (string $yaml)
  • string $yaml: String containing YAML
static loadFile (line 99)

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.

  • return: PHP array representation of YAML content
  • throws: IllegalArgumentException If $filename is invalid
  • throws: Horde_Yaml_Exception If the file cannot be opened.
  • access: public
static array loadFile (string $filename)
  • string $filename: Filename to load
static loadStream (line 120)

Load YAML from a PHP stream resource.

  • return: PHP array representation of YAML content
  • access: public
static array loadStream (resource $stream)
  • resource $stream: PHP stream resource

Documentation generated on Sun, 30 Jan 2011 05:23:33 +0000 by phpDocumentor 1.4.3