Class: Spyc (Development): Difference between revisions
(Created page with '{{otherversions|Class: Spyc}} This article describes the class ''Spyc'' . *Location: Part of the module YAML_spyc in the package [htt…') |
No edit summary |
||
Line 1: | Line 1: | ||
{{otherversions|Class: Spyc}} | {{otherversions|Class: Spyc}} | ||
This article describes the class ''Spyc'' . | This article describes the class ''Spyc'' . | ||
*Location: Part of the module [[I2CE Module List (Development)#YAML_spyc|YAML_spyc]] in the package [https://launchpad.net/i2ce I2CE] 4. | *Location: Part of the module [[I2CE Module List (Development)#YAML_spyc|YAML_spyc]] in the package [https://launchpad.net/i2ce I2CE] 4.1-dev | ||
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L26 modules/YAML/lib/spyc.php] on line 26 | ||
*Author: Chris Wanstrath <chris@ozmm.org> | *Author: Chris Wanstrath <chris@ozmm.org> | ||
Line 9: | Line 9: | ||
==Variables== | ==Variables== | ||
===$_haveRefs=== | ===$_haveRefs=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L32 i2ce/modules/YAML/lib/spyc.php] on line 32 | ||
*Type: private $_haveRefs | *Type: private $_haveRefs | ||
===$_allNodes=== | ===$_allNodes=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L33 i2ce/modules/YAML/lib/spyc.php] on line 33 | ||
*Type: private $_allNodes | *Type: private $_allNodes | ||
===$_allParent=== | ===$_allParent=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L34 i2ce/modules/YAML/lib/spyc.php] on line 34 | ||
*Type: private $_allParent | *Type: private $_allParent | ||
===$_lastIndent=== | ===$_lastIndent=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L35 i2ce/modules/YAML/lib/spyc.php] on line 35 | ||
*Type: private $_lastIndent | *Type: private $_lastIndent | ||
===$_lastNode=== | ===$_lastNode=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L36 i2ce/modules/YAML/lib/spyc.php] on line 36 | ||
*Type: private $_lastNode | *Type: private $_lastNode | ||
===$_inBlock=== | ===$_inBlock=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L37 i2ce/modules/YAML/lib/spyc.php] on line 37 | ||
*Type: private $_inBlock | *Type: private $_inBlock | ||
===$_isInline=== | ===$_isInline=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L38 i2ce/modules/YAML/lib/spyc.php] on line 38 | ||
*Type: private $_isInline | *Type: private $_isInline | ||
===$_dumpIndent=== | ===$_dumpIndent=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L39 i2ce/modules/YAML/lib/spyc.php] on line 39 | ||
*Type: private $_dumpIndent | *Type: private $_dumpIndent | ||
===$_dumpWordWrap=== | ===$_dumpWordWrap=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L40 i2ce/modules/YAML/lib/spyc.php] on line 40 | ||
*Type: private $_dumpWordWrap | *Type: private $_dumpWordWrap | ||
===$_containsGroupAnchor=== | ===$_containsGroupAnchor=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L41 i2ce/modules/YAML/lib/spyc.php] on line 41 | ||
*Type: private $_containsGroupAnchor | *Type: private $_containsGroupAnchor | ||
===$_containsGroupAlias=== | ===$_containsGroupAlias=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L42 i2ce/modules/YAML/lib/spyc.php] on line 42 | ||
*Type: private $_containsGroupAlias | *Type: private $_containsGroupAlias | ||
===$path=== | ===$path=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L43 i2ce/modules/YAML/lib/spyc.php] on line 43 | ||
*Type: private $path | *Type: private $path | ||
===$result=== | ===$result=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L44 i2ce/modules/YAML/lib/spyc.php] on line 44 | ||
*Type: private $result | *Type: private $result | ||
===$LiteralBlockMarkers=== | ===$LiteralBlockMarkers=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L45 i2ce/modules/YAML/lib/spyc.php] on line 45 | ||
*Type: private $LiteralBlockMarkers | *Type: private $LiteralBlockMarkers | ||
===$LiteralPlaceHolder=== | ===$LiteralPlaceHolder=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L46 i2ce/modules/YAML/lib/spyc.php] on line 46 | ||
*Type: private $LiteralPlaceHolder | *Type: private $LiteralPlaceHolder | ||
===$SavedGroups=== | ===$SavedGroups=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L47 i2ce/modules/YAML/lib/spyc.php] on line 47 | ||
*Type: private $SavedGroups | *Type: private $SavedGroups | ||
===$_nodeId=== | ===$_nodeId=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L53 i2ce/modules/YAML/lib/spyc.php] on line 53 | ||
*Type: public $_nodeId | *Type: public $_nodeId | ||
Line 79: | Line 79: | ||
===YAMLDump()=== | ===YAMLDump()=== | ||
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.yaml 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 | 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.yaml 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 | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L95 i2ce/modules/YAML/lib/spyc.php] on line 95 | ||
*Signature: static public function YAMLDump($array,$indent,$wordwrap) | *Signature: static public function YAMLDump($array,$indent,$wordwrap) | ||
*Parameters: | *Parameters: | ||
Line 90: | Line 90: | ||
===YAMLLoad()=== | ===YAMLLoad()=== | ||
Load YAML into a PHP array statically 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. Pretty simple. Usage: <code> $array = Spyc::YAMLLoad('lucky.yaml'); print_r($array); </code> @access public | Load YAML into a PHP array statically 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. Pretty simple. Usage: <code> $array = Spyc::YAMLLoad('lucky.yaml'); print_r($array); </code> @access public | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L70 i2ce/modules/YAML/lib/spyc.php] on line 70 | ||
*Signature: static public function YAMLLoad($input) | *Signature: static public function YAMLLoad($input) | ||
*Parameters: | *Parameters: | ||
Line 97: | Line 97: | ||
===_doFolding()=== | ===_doFolding()=== | ||
Folds a string of text, if necessary @access private | Folds a string of text, if necessary @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L247 i2ce/modules/YAML/lib/spyc.php] on line 247 | ||
*Signature: private function _doFolding($value,$indent) | *Signature: private function _doFolding($value,$indent) | ||
*Parameters: | *Parameters: | ||
Line 105: | Line 105: | ||
===_doLiteralBlock()=== | ===_doLiteralBlock()=== | ||
Creates a literal block for dumping @access private | Creates a literal block for dumping @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L230 i2ce/modules/YAML/lib/spyc.php] on line 230 | ||
*Signature: private function _doLiteralBlock($value,$indent) | *Signature: private function _doLiteralBlock($value,$indent) | ||
*Parameters: | *Parameters: | ||
Line 113: | Line 113: | ||
===_dumpNode()=== | ===_dumpNode()=== | ||
Returns YAML from a key and a value @access private | Returns YAML from a key and a value @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L199 i2ce/modules/YAML/lib/spyc.php] on line 199 | ||
*Signature: private function _dumpNode($key,$value,$indent) | *Signature: private function _dumpNode($key,$value,$indent) | ||
*Parameters: | *Parameters: | ||
Line 122: | Line 122: | ||
===_getIndent()=== | ===_getIndent()=== | ||
Finds and returns the indentation of a YAML line @access private | Finds and returns the indentation of a YAML line @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L315 i2ce/modules/YAML/lib/spyc.php] on line 315 | ||
*Signature: private function _getIndent($line) | *Signature: private function _getIndent($line) | ||
*Parameters: | *Parameters: | ||
Line 129: | Line 129: | ||
===_inlineEscape()=== | ===_inlineEscape()=== | ||
Used in inlines to check for more inlines or quoted strings @access private | Used in inlines to check for more inlines or quoted strings @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L427 i2ce/modules/YAML/lib/spyc.php] on line 427 | ||
*Signature: private function _inlineEscape($inline) | *Signature: private function _inlineEscape($inline) | ||
*Parameters: | *Parameters: | ||
Line 136: | Line 136: | ||
===_parseLine()=== | ===_parseLine()=== | ||
Parses YAML code and returns an array for a node @access private | Parses YAML code and returns an array for a node @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L327 i2ce/modules/YAML/lib/spyc.php] on line 327 | ||
*Signature: private function _parseLine($line) | *Signature: private function _parseLine($line) | ||
*Parameters: | *Parameters: | ||
Line 143: | Line 143: | ||
===_toType()=== | ===_toType()=== | ||
Finds the type of the passed value, returns the value as the new type. @access private | Finds the type of the passed value, returns the value as the new type. @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L359 i2ce/modules/YAML/lib/spyc.php] on line 359 | ||
*Signature: private function _toType($value) | *Signature: private function _toType($value) | ||
*Parameters: | *Parameters: | ||
Line 150: | Line 150: | ||
===_yamlize()=== | ===_yamlize()=== | ||
Attempts to convert a key / value array item to YAML @access private | Attempts to convert a key / value array item to YAML @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L156 i2ce/modules/YAML/lib/spyc.php] on line 156 | ||
*Signature: private function _yamlize($key,$value,$indent) | *Signature: private function _yamlize($key,$value,$indent) | ||
*Parameters: | *Parameters: | ||
Line 159: | Line 159: | ||
===_yamlizeArray()=== | ===_yamlizeArray()=== | ||
Attempts to convert an array to YAML @access private | Attempts to convert an array to YAML @access private | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L179 i2ce/modules/YAML/lib/spyc.php] on line 179 | ||
*Signature: private function _yamlizeArray($array,$indent) | *Signature: private function _yamlizeArray($array,$indent) | ||
*Parameters: | *Parameters: | ||
Line 166: | Line 166: | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]@param $array The array you want to convert @param $indent The indent of the current level | *Returns: [http://www.php.net/manual/en/language.types.string.php string ]@param $array The array you want to convert @param $indent The indent of the current level | ||
===addArray()=== | ===addArray()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L502 i2ce/modules/YAML/lib/spyc.php] on line 502 | ||
*Signature: private function addArray($array,$indent) | *Signature: private function addArray($array,$indent) | ||
*Parameters: | *Parameters: | ||
Line 172: | Line 172: | ||
**$indent | **$indent | ||
===addGroup()=== | ===addGroup()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L728 i2ce/modules/YAML/lib/spyc.php] on line 728 | ||
*Signature: private function addGroup($line,$group) | *Signature: private function addGroup($line,$group) | ||
*Parameters: | *Parameters: | ||
Line 178: | Line 178: | ||
**$group | **$group | ||
===addLiteralLine()=== | ===addLiteralLine()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L569 i2ce/modules/YAML/lib/spyc.php] on line 569 | ||
*Signature: private function addLiteralLine($literalBlock,$line,$literalBlockStyle) | *Signature: private function addLiteralLine($literalBlock,$line,$literalBlockStyle) | ||
*Parameters: | *Parameters: | ||
Line 185: | Line 185: | ||
**$literalBlockStyle | **$literalBlockStyle | ||
===clearBiggerPathValues()=== | ===clearBiggerPathValues()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L612 i2ce/modules/YAML/lib/spyc.php] on line 612 | ||
*Signature: private function clearBiggerPathValues($indent) | *Signature: private function clearBiggerPathValues($indent) | ||
*Parameters: | *Parameters: | ||
Line 191: | Line 191: | ||
===dump()=== | ===dump()=== | ||
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.yaml 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 | 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.yaml 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 | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L121 i2ce/modules/YAML/lib/spyc.php] on line 121 | ||
*Signature: public function dump($array,$indent,$wordwrap) | *Signature: public function dump($array,$indent,$wordwrap) | ||
*Parameters: | *Parameters: | ||
Line 201: | Line 201: | ||
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] | *Returns: [http://www.php.net/manual/en/language.types.string.php string ] | ||
===flatten()=== | ===flatten()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L547 i2ce/modules/YAML/lib/spyc.php] on line 547 | ||
*Signature: private function flatten($array) | *Signature: private function flatten($array) | ||
*Parameters: | *Parameters: | ||
**$array | **$array | ||
===getParentPathByIndent()=== | ===getParentPathByIndent()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L599 i2ce/modules/YAML/lib/spyc.php] on line 599 | ||
*Signature: private function getParentPathByIndent($indent) | *Signature: private function getParentPathByIndent($indent) | ||
*Parameters: | *Parameters: | ||
**$indent | **$indent | ||
===isArrayElement()=== | ===isArrayElement()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L631 i2ce/modules/YAML/lib/spyc.php] on line 631 | ||
*Signature: private function isArrayElement($line) | *Signature: private function isArrayElement($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===isComment()=== | ===isComment()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L626 i2ce/modules/YAML/lib/spyc.php] on line 626 | ||
*Signature: private function isComment($line) | *Signature: private function isComment($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===isHashElement()=== | ===isHashElement()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L640 i2ce/modules/YAML/lib/spyc.php] on line 640 | ||
*Signature: private function isHashElement($line) | *Signature: private function isHashElement($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===isLiteral()=== | ===isLiteral()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L648 i2ce/modules/YAML/lib/spyc.php] on line 648 | ||
*Signature: private function isLiteral($line) | *Signature: private function isLiteral($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===literalBlockContinues()=== | ===literalBlockContinues()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L496 i2ce/modules/YAML/lib/spyc.php] on line 496 | ||
*Signature: private function literalBlockContinues($line,$lineIndent) | *Signature: private function literalBlockContinues($line,$lineIndent) | ||
*Parameters: | *Parameters: | ||
Line 237: | Line 237: | ||
**$lineIndent | **$lineIndent | ||
===load()=== | ===load()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L264 i2ce/modules/YAML/lib/spyc.php] on line 264 | ||
*Signature: private function load($input) | *Signature: private function load($input) | ||
*Parameters: | *Parameters: | ||
**$input | **$input | ||
===loadFromSource()=== | ===loadFromSource()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L297 i2ce/modules/YAML/lib/spyc.php] on line 297 | ||
*Signature: private function loadFromSource($input) | *Signature: private function loadFromSource($input) | ||
*Parameters: | *Parameters: | ||
**$input | **$input | ||
===nodeContainsGroup()=== | ===nodeContainsGroup()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L719 i2ce/modules/YAML/lib/spyc.php] on line 719 | ||
*Signature: private function nodeContainsGroup($line) | *Signature: private function nodeContainsGroup($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===returnArrayElement()=== | ===returnArrayElement()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L709 i2ce/modules/YAML/lib/spyc.php] on line 709 | ||
*Signature: private function returnArrayElement($line) | *Signature: private function returnArrayElement($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===returnKeyValuePair()=== | ===returnKeyValuePair()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L677 i2ce/modules/YAML/lib/spyc.php] on line 677 | ||
*Signature: private function returnKeyValuePair($line) | *Signature: private function returnKeyValuePair($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===returnMappedSequence()=== | ===returnMappedSequence()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L659 i2ce/modules/YAML/lib/spyc.php] on line 659 | ||
*Signature: private function returnMappedSequence($line) | *Signature: private function returnMappedSequence($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===returnMappedValue()=== | ===returnMappedValue()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L666 i2ce/modules/YAML/lib/spyc.php] on line 666 | ||
*Signature: private function returnMappedValue($line) | *Signature: private function returnMappedValue($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===revertLiteralPlaceHolder()=== | ===revertLiteralPlaceHolder()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L585 i2ce/modules/YAML/lib/spyc.php] on line 585 | ||
*Signature: private function revertLiteralPlaceHolder($lineArray,$literalBlock) | *Signature: private function revertLiteralPlaceHolder($lineArray,$literalBlock) | ||
*Parameters: | *Parameters: | ||
Line 278: | Line 278: | ||
**$literalBlock | **$literalBlock | ||
===startsLiteralBlock()=== | ===startsLiteralBlock()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L562 i2ce/modules/YAML/lib/spyc.php] on line 562 | ||
*Signature: private function startsLiteralBlock($line) | *Signature: private function startsLiteralBlock($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===startsMappedSequence()=== | ===startsMappedSequence()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L655 i2ce/modules/YAML/lib/spyc.php] on line 655 | ||
*Signature: private function startsMappedSequence($line) | *Signature: private function startsMappedSequence($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===startsMappedValue()=== | ===startsMappedValue()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L673 i2ce/modules/YAML/lib/spyc.php] on line 673 | ||
*Signature: private function startsMappedValue($line) | *Signature: private function startsMappedValue($line) | ||
*Parameters: | *Parameters: | ||
**$line | **$line | ||
===stripGroup()=== | ===stripGroup()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L734 i2ce/modules/YAML/lib/spyc.php] on line 734 | ||
*Signature: private function stripGroup($line,$group) | *Signature: private function stripGroup($line,$group) | ||
*Parameters: | *Parameters: | ||
Line 299: | Line 299: | ||
**$group | **$group | ||
===stripIndent()=== | ===stripIndent()=== | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/YAML/lib/spyc.php#L594 i2ce/modules/YAML/lib/spyc.php] on line 594 | ||
*Signature: private function stripIndent($line,$indent) | *Signature: private function stripIndent($line,$indent) | ||
*Parameters: | *Parameters: |
Latest revision as of 08:20, 6 May 2015
This article describes the class Spyc .
- Location: Part of the module YAML_spyc in the package I2CE 4.1-dev
- Source: Defined in the file modules/YAML/lib/spyc.php on line 26
- Author: Chris Wanstrath <chris@ozmm.org>
- Author: Vlad Andersen <vlad@oneiros.ru>
Spyc -- A Simple PHP YAML Class @link http://spyc.sourceforge.net/ @copyright Copyright 2005-2006 Chris Wanstrath @license 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. Usage: $parser = new Spyc; $array = $parser->load($file);
Variables
$_haveRefs
- Defined in i2ce/modules/YAML/lib/spyc.php on line 32
- Type: private $_haveRefs
$_allNodes
- Defined in i2ce/modules/YAML/lib/spyc.php on line 33
- Type: private $_allNodes
$_allParent
- Defined in i2ce/modules/YAML/lib/spyc.php on line 34
- Type: private $_allParent
$_lastIndent
- Defined in i2ce/modules/YAML/lib/spyc.php on line 35
- Type: private $_lastIndent
$_lastNode
- Defined in i2ce/modules/YAML/lib/spyc.php on line 36
- Type: private $_lastNode
$_inBlock
- Defined in i2ce/modules/YAML/lib/spyc.php on line 37
- Type: private $_inBlock
$_isInline
- Defined in i2ce/modules/YAML/lib/spyc.php on line 38
- Type: private $_isInline
$_dumpIndent
- Defined in i2ce/modules/YAML/lib/spyc.php on line 39
- Type: private $_dumpIndent
$_dumpWordWrap
- Defined in i2ce/modules/YAML/lib/spyc.php on line 40
- Type: private $_dumpWordWrap
$_containsGroupAnchor
- Defined in i2ce/modules/YAML/lib/spyc.php on line 41
- Type: private $_containsGroupAnchor
$_containsGroupAlias
- Defined in i2ce/modules/YAML/lib/spyc.php on line 42
- Type: private $_containsGroupAlias
$path
- Defined in i2ce/modules/YAML/lib/spyc.php on line 43
- Type: private $path
$result
- Defined in i2ce/modules/YAML/lib/spyc.php on line 44
- Type: private $result
$LiteralBlockMarkers
- Defined in i2ce/modules/YAML/lib/spyc.php on line 45
- Type: private $LiteralBlockMarkers
$LiteralPlaceHolder
- Defined in i2ce/modules/YAML/lib/spyc.php on line 46
- Type: private $LiteralPlaceHolder
$SavedGroups
- Defined in i2ce/modules/YAML/lib/spyc.php on line 47
- Type: private $SavedGroups
$_nodeId
- Defined in i2ce/modules/YAML/lib/spyc.php on line 53
- Type: public $_nodeId
Methods
YAMLDump()
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.yaml 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
- Defined in i2ce/modules/YAML/lib/spyc.php on line 95
- Signature: static public function YAMLDump($array,$indent,$wordwrap)
- Parameters:
- Returns: string
YAMLLoad()
Load YAML into a PHP array statically 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. Pretty simple. Usage: $array = Spyc::YAMLLoad('lucky.yaml'); print_r($array);
@access public
- Defined in i2ce/modules/YAML/lib/spyc.php on line 70
- Signature: static public function YAMLLoad($input)
- Parameters:
- string $input
Path of YAML file or string containing YAML
- string $input
- Returns: array
_doFolding()
Folds a string of text, if necessary @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 247
- Signature: private function _doFolding($value,$indent)
- Parameters:
- $value
- $indent
- Returns: string @param $value The string you wish to fold
_doLiteralBlock()
Creates a literal block for dumping @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 230
- Signature: private function _doLiteralBlock($value,$indent)
- Parameters:
- $value
- $indent
- Returns: string @param $value @param $indent int The value of the indent
_dumpNode()
Returns YAML from a key and a value @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 199
- Signature: private function _dumpNode($key,$value,$indent)
- Parameters:
- $key
- $value
- $indent
- Returns: string @param $key The name of the key @param $value The value of the item @param $indent The indent of the current node
_getIndent()
Finds and returns the indentation of a YAML line @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 315
- Signature: private function _getIndent($line)
- Parameters:
- string $line
A line from the YAML file
- string $line
- Returns: int
_inlineEscape()
Used in inlines to check for more inlines or quoted strings @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 427
- Signature: private function _inlineEscape($inline)
- Parameters:
- $inline
- Returns: array
_parseLine()
Parses YAML code and returns an array for a node @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 327
- Signature: private function _parseLine($line)
- Parameters:
- string $line
A line from the YAML file
- string $line
- Returns: array
_toType()
Finds the type of the passed value, returns the value as the new type. @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 359
- Signature: private function _toType($value)
- Parameters:
- string $value
- Returns: mixed
_yamlize()
Attempts to convert a key / value array item to YAML @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 156
- Signature: private function _yamlize($key,$value,$indent)
- Parameters:
- $key
- $value
- $indent
- Returns: string @param $key The name of the key @param $value The value of the item @param $indent The indent of the current node
_yamlizeArray()
Attempts to convert an array to YAML @access private
- Defined in i2ce/modules/YAML/lib/spyc.php on line 179
- Signature: private function _yamlizeArray($array,$indent)
- Parameters:
- $array
- $indent
- Returns: string @param $array The array you want to convert @param $indent The indent of the current level
addArray()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 502
- Signature: private function addArray($array,$indent)
- Parameters:
- $array
- $indent
addGroup()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 728
- Signature: private function addGroup($line,$group)
- Parameters:
- $line
- $group
addLiteralLine()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 569
- Signature: private function addLiteralLine($literalBlock,$line,$literalBlockStyle)
- Parameters:
- $literalBlock
- $line
- $literalBlockStyle
clearBiggerPathValues()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 612
- Signature: private function clearBiggerPathValues($indent)
- Parameters:
- $indent
dump()
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.yaml 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
- Defined in i2ce/modules/YAML/lib/spyc.php on line 121
- Signature: public function dump($array,$indent,$wordwrap)
- Parameters:
- Returns: string
flatten()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 547
- Signature: private function flatten($array)
- Parameters:
- $array
getParentPathByIndent()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 599
- Signature: private function getParentPathByIndent($indent)
- Parameters:
- $indent
isArrayElement()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 631
- Signature: private function isArrayElement($line)
- Parameters:
- $line
isComment()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 626
- Signature: private function isComment($line)
- Parameters:
- $line
isHashElement()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 640
- Signature: private function isHashElement($line)
- Parameters:
- $line
isLiteral()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 648
- Signature: private function isLiteral($line)
- Parameters:
- $line
literalBlockContinues()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 496
- Signature: private function literalBlockContinues($line,$lineIndent)
- Parameters:
- $line
- $lineIndent
load()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 264
- Signature: private function load($input)
- Parameters:
- $input
loadFromSource()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 297
- Signature: private function loadFromSource($input)
- Parameters:
- $input
nodeContainsGroup()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 719
- Signature: private function nodeContainsGroup($line)
- Parameters:
- $line
returnArrayElement()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 709
- Signature: private function returnArrayElement($line)
- Parameters:
- $line
returnKeyValuePair()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 677
- Signature: private function returnKeyValuePair($line)
- Parameters:
- $line
returnMappedSequence()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 659
- Signature: private function returnMappedSequence($line)
- Parameters:
- $line
returnMappedValue()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 666
- Signature: private function returnMappedValue($line)
- Parameters:
- $line
revertLiteralPlaceHolder()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 585
- Signature: private function revertLiteralPlaceHolder($lineArray,$literalBlock)
- Parameters:
- $lineArray
- $literalBlock
startsLiteralBlock()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 562
- Signature: private function startsLiteralBlock($line)
- Parameters:
- $line
startsMappedSequence()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 655
- Signature: private function startsMappedSequence($line)
- Parameters:
- $line
startsMappedValue()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 673
- Signature: private function startsMappedValue($line)
- Parameters:
- $line
stripGroup()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 734
- Signature: private function stripGroup($line,$group)
- Parameters:
- $line
- $group
stripIndent()
- Defined in i2ce/modules/YAML/lib/spyc.php on line 594
- Signature: private function stripIndent($line,$indent)
- Parameters:
- $line
- $indent
- Default Value: -1