Class: Spyc (4.0.21)

From IHRIS Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


This article describes the class Spyc .

  • 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

$_allNodes

$_allParent

$_lastIndent

$_lastNode

$_inBlock

$_isInline

$_dumpIndent

$_dumpWordWrap

$_containsGroupAnchor

$_containsGroupAlias

$path

$result

$LiteralBlockMarkers

$LiteralPlaceHolder

$SavedGroups

$_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:
    • array $array
      PHP array
    • int $indent
      Pass in false to use the default, which is 2
      • Default Value: false
    • int $wordwrap
      Pass in 0 for no wordwrap, false for default (40)
      • Default Value: false
  • 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

_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

_inlineEscape()

Used in inlines to check for more inlines or quoted strings @access private

_parseLine()

Parses YAML code and returns an array for a node @access private

_toType()

Finds the type of the passed value, returns the value as the new type. @access private

_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()

addGroup()

addLiteralLine()

  • Defined in i2ce/modules/YAML/lib/spyc.php on line 569
  • Signature: private function addLiteralLine($literalBlock,$line,$literalBlockStyle)
  • Parameters:
    • $literalBlock
    • $line
    • $literalBlockStyle

clearBiggerPathValues()

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:
    • array $array
      PHP array
    • int $indent
      Pass in false to use the default, which is 2
      • Default Value: false
    • int $wordwrap
      Pass in 0 for no wordwrap, false for default (40)
      • Default Value: false
  • Returns: string

flatten()

getParentPathByIndent()

isArrayElement()

isComment()

isHashElement()

isLiteral()

literalBlockContinues()

  • Defined in i2ce/modules/YAML/lib/spyc.php on line 496
  • Signature: private function literalBlockContinues($line,$lineIndent)
  • Parameters:
    • $line
    • $lineIndent

load()

loadFromSource()

nodeContainsGroup()

returnArrayElement()

returnKeyValuePair()

returnMappedSequence()

returnMappedValue()

revertLiteralPlaceHolder()

  • Defined in i2ce/modules/YAML/lib/spyc.php on line 585
  • Signature: private function revertLiteralPlaceHolder($lineArray,$literalBlock)
  • Parameters:
    • $lineArray
    • $literalBlock

startsLiteralBlock()

startsMappedSequence()

startsMappedValue()

stripGroup()

stripIndent()

  • Defined in i2ce/modules/YAML/lib/spyc.php on line 594
  • Signature: private function stripIndent($line,$indent)
  • Parameters:
    • $line
    • $indent
      • Default Value: -1