Spyc Class Reference
[API]

Spyc -- A Simple PHP YAML Class. More...

List of all members.

Public Member Functions

 dump ($array, $indent=false, $wordwrap=false)
 Dump PHP array to YAML.
 _needLiteral ($value)
 Find out whether a string needs to be output as a literal rather than in plain style.

Static Public Member Functions

static YAMLDump ($array, $indent=false, $wordwrap=false)
 Dump YAML from PHP array statically.

Private Member Functions

 _yamlize ($key, $value, $indent)
 Attempts to convert a key / value array item to YAML.
 _yamlizeArray ($array, $indent)
 Attempts to convert an array to YAML.
 _dumpNode ($key, $value, $indent)
 Returns YAML from a key and a value.
 _doLiteralBlock ($value, $indent)
 Creates a literal block for dumping.
 _doFolding ($value, $indent)
 Folds a string of text, if necessary.

Private Attributes

 $_haveRefs
 $_allNodes
 $_lastIndent
 $_lastNode
 $_inBlock
 $_isInline
 $_dumpIndent
 $_dumpWordWrap


Detailed Description

Spyc -- A Simple PHP YAML Class.

Version:
0.2.3 -- 2006-02-04
Author:
Chris Wanstrath <chris@ozmm.org>
See also:
http://spyc.sourceforge.net/ Copyright 2005-2006 Chris Wanstrath http://www.opensource.org/licenses/mit-license.php MIT License The Simple PHP YAML Class.
This class can be used to read a YAML file and convert its contents into a PHP array. It currently supports a very limited subsection of the YAML spec.

Definition at line 20 of file ApiFormatYaml_spyc.php.


Member Function Documentation

Spyc::_doFolding ( value,
indent 
) [private]

Folds a string of text, if necessary.

Returns:
string
Parameters:
$value The string you wish to fold

Definition at line 220 of file ApiFormatYaml_spyc.php.

Referenced by _dumpNode().

Spyc::_doLiteralBlock ( value,
indent 
) [private]

Creates a literal block for dumping.

Returns:
string
Parameters:
$value 
$indent int The value of the indent

Definition at line 204 of file ApiFormatYaml_spyc.php.

Referenced by _dumpNode().

Spyc::_dumpNode ( key,
value,
indent 
) [private]

Returns YAML from a key and a value.

Returns:
string
Parameters:
$key The name of the key
$value The value of the item
$indent The indent of the current node

Definition at line 172 of file ApiFormatYaml_spyc.php.

References $key, _doFolding(), _doLiteralBlock(), and _needLiteral().

Referenced by _yamlize().

Spyc::_needLiteral ( value  ) 

Find out whether a string needs to be output as a literal rather than in plain style.

Added by Roan Kattouw 13-03-2008

Parameters:
$value The string to check
Returns:
bool

Definition at line 153 of file ApiFormatYaml_spyc.php.

Referenced by _dumpNode().

Spyc::_yamlize ( key,
value,
indent 
) [private]

Attempts to convert a key / value array item to YAML.

Returns:
string
Parameters:
$key The name of the key
$value The value of the item
$indent The indent of the current node

Definition at line 113 of file ApiFormatYaml_spyc.php.

References $key, _dumpNode(), and _yamlizeArray().

Referenced by _yamlizeArray(), and dump().

Spyc::_yamlizeArray ( array,
indent 
) [private]

Attempts to convert an array to YAML.

Returns:
string
Parameters:
$array The array you want to convert
$indent The indent of the current level

Definition at line 135 of file ApiFormatYaml_spyc.php.

References $key, and _yamlize().

Referenced by _yamlize().

Spyc::dump ( array,
indent = false,
wordwrap = false 
)

Dump PHP array to YAML.

The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as tasteful.yml and pass it around.

Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.

Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.

Access:
public
Returns:
string
Parameters:
$array Array: PHP array
$indent Integer: Pass in false to use the default, which is 2
$wordwrap Integer: Pass in 0 for no wordwrap, false for default (40)

Definition at line 66 of file ApiFormatYaml_spyc.php.

References $key, and _yamlize().

static Spyc::YAMLDump ( array,
indent = false,
wordwrap = false 
) [static]

Dump YAML from PHP array statically.

The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as nothing.yml and pass it around.

Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.

Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.

Returns:
string
Parameters:
$array Array: PHP array
$indent Integer: Pass in false to use the default, which is 2
$wordwrap Integer: Pass in 0 for no wordwrap, false for default (40)

Definition at line 41 of file ApiFormatYaml_spyc.php.

Referenced by ApiFormatYaml::execute().


Member Data Documentation

Spyc::$_allNodes [private]

Definition at line 96 of file ApiFormatYaml_spyc.php.

Spyc::$_dumpIndent [private]

Definition at line 101 of file ApiFormatYaml_spyc.php.

Spyc::$_dumpWordWrap [private]

Definition at line 102 of file ApiFormatYaml_spyc.php.

Spyc::$_haveRefs [private]

Definition at line 95 of file ApiFormatYaml_spyc.php.

Spyc::$_inBlock [private]

Definition at line 99 of file ApiFormatYaml_spyc.php.

Spyc::$_isInline [private]

Definition at line 100 of file ApiFormatYaml_spyc.php.

Spyc::$_lastIndent [private]

Definition at line 97 of file ApiFormatYaml_spyc.php.

Spyc::$_lastNode [private]

Definition at line 98 of file ApiFormatYaml_spyc.php.


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:47 2009 for MediaWiki by  doxygen 1.5.9