Renamed Spyc to DoctrineSpyc to avoid any conflicts with other libraries.
This commit is contained in:
parent
a085706070
commit
7bbcb51dcf
@ -45,7 +45,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser
|
|||||||
*/
|
*/
|
||||||
public function dumpData($array, $path = null)
|
public function dumpData($array, $path = null)
|
||||||
{
|
{
|
||||||
$spyc = new Spyc();
|
$spyc = new DoctrineSpyc();
|
||||||
|
|
||||||
$yml = $spyc->dump($array, false, false);
|
$yml = $spyc->dump($array, false, false);
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class Doctrine_Parser_Yml extends Doctrine_Parser
|
|||||||
*/
|
*/
|
||||||
public function loadData($path)
|
public function loadData($path)
|
||||||
{
|
{
|
||||||
$spyc = new Spyc();
|
$spyc = new DoctrineSpyc();
|
||||||
|
|
||||||
$array = $spyc->load($path);
|
$array = $spyc->load($path);
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Spyc -- A Simple PHP YAML Class
|
* DoctrineSpyc -- A Simple PHP YAML Class
|
||||||
* @version 0.2.(5) -- 2006-12-31
|
* @version 0.2.(5) -- 2006-12-31
|
||||||
* @author Chris Wanstrath <chris@ozmm.org>
|
* @author Chris Wanstrath <chris@ozmm.org>
|
||||||
* @author Vlad Andersen <vlad@oneiros.ru>
|
* @author Vlad Andersen <vlad@oneiros.ru>
|
||||||
* @link http://spyc.sourceforge.net/
|
* @link http://spyc.sourceforge.net/
|
||||||
* @copyright Copyright 2005-2006 Chris Wanstrath
|
* @copyright Copyright 2005-2006 Chris Wanstrath
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
* @package Spyc
|
* @package DoctrineSpyc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A node, used by Spyc for parsing YAML.
|
* A node, used by DoctrineSpyc for parsing YAML.
|
||||||
* @package Spyc
|
* @package DoctrineSpyc
|
||||||
*/
|
*/
|
||||||
class YAMLNode {
|
class DoctrineYAMLNode {
|
||||||
/**#@+
|
/**#@+
|
||||||
* @access public
|
* @access public
|
||||||
* @var string
|
* @var string
|
||||||
@ -43,7 +43,7 @@
|
|||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function YAMLNode($nodeId) {
|
function DoctrineYAMLNode($nodeId) {
|
||||||
$this->id = $nodeId;
|
$this->id = $nodeId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,12 +57,12 @@
|
|||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* <code>
|
* <code>
|
||||||
* $parser = new Spyc;
|
* $parser = new DoctrineSpyc;
|
||||||
* $array = $parser->load($file);
|
* $array = $parser->load($file);
|
||||||
* </code>
|
* </code>
|
||||||
* @package Spyc
|
* @package DoctrineSpyc
|
||||||
*/
|
*/
|
||||||
class Spyc {
|
class DoctrineSpyc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load YAML into a PHP array statically
|
* Load YAML into a PHP array statically
|
||||||
@ -72,7 +72,7 @@
|
|||||||
* simple.
|
* simple.
|
||||||
* Usage:
|
* Usage:
|
||||||
* <code>
|
* <code>
|
||||||
* $array = Spyc::YAMLLoad('lucky.yaml');
|
* $array = DoctrineSpyc::YAMLLoad('lucky.yaml');
|
||||||
* print_r($array);
|
* print_r($array);
|
||||||
* </code>
|
* </code>
|
||||||
* @access public
|
* @access public
|
||||||
@ -80,7 +80,7 @@
|
|||||||
* @param string $input Path of YAML file or string containing YAML
|
* @param string $input Path of YAML file or string containing YAML
|
||||||
*/
|
*/
|
||||||
function YAMLLoad($input) {
|
function YAMLLoad($input) {
|
||||||
$spyc = new Spyc;
|
$spyc = new DoctrineSpyc;
|
||||||
return $spyc->load($input);
|
return $spyc->load($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@
|
|||||||
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
|
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
|
||||||
*/
|
*/
|
||||||
function YAMLDump($array,$indent = false,$wordwrap = false) {
|
function YAMLDump($array,$indent = false,$wordwrap = false) {
|
||||||
$spyc = new Spyc;
|
$spyc = new DoctrineSpyc;
|
||||||
return $spyc->dump($array,$indent,$wordwrap);
|
return $spyc->dump($array,$indent,$wordwrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@
|
|||||||
* will do its best to convert the YAML into a PHP array. Pretty simple.
|
* will do its best to convert the YAML into a PHP array. Pretty simple.
|
||||||
* Usage:
|
* Usage:
|
||||||
* <code>
|
* <code>
|
||||||
* $parser = new Spyc;
|
* $parser = new DoctrineSpyc;
|
||||||
* $array = $parser->load('lucky.yaml');
|
* $array = $parser->load('lucky.yaml');
|
||||||
* print_r($array);
|
* print_r($array);
|
||||||
* </code>
|
* </code>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
$yaml = explode("\n",$input);
|
$yaml = explode("\n",$input);
|
||||||
}
|
}
|
||||||
// Initiate some objects and values
|
// Initiate some objects and values
|
||||||
$base = new YAMLNode (1);
|
$base = new DoctrineYAMLNode (1);
|
||||||
$base->indent = 0;
|
$base->indent = 0;
|
||||||
$this->_lastIndent = 0;
|
$this->_lastIndent = 0;
|
||||||
$this->_lastNode = $base->id;
|
$this->_lastNode = $base->id;
|
||||||
@ -159,7 +159,7 @@
|
|||||||
$last->data[key($last->data)] .= "\n";
|
$last->data[key($last->data)] .= "\n";
|
||||||
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
|
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
|
||||||
// Create a new node and get its indent
|
// Create a new node and get its indent
|
||||||
$node = new YAMLNode ($this->_nodeId);
|
$node = new DoctrineYAMLNode ($this->_nodeId);
|
||||||
$this->_nodeId++;
|
$this->_nodeId++;
|
||||||
|
|
||||||
$node->indent = $this->_getIndent($line);
|
$node->indent = $this->_getIndent($line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user