cvs: pear /Config/Config/Container IniCommented.php

From: Date: Tue, 17 Dec 2002 15:47:01 +0000
Subject: cvs: pear /Config/Config/Container IniCommented.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7913@lists.php.net to get a copy of this message
mansion Tue Dec 17 10:47:01 2002 EDT Modified files: /pear/Config/Config/Container IniCommented.php Log: Add reference to config object as parameter because of :: Index: pear/Config/Config/Container/IniCommented.php diff -u pear/Config/Config/Container/IniCommented.php:1.4 pear/Config/Config/Container/IniCommented.php:1.5 --- pear/Config/Config/Container/IniCommented.php:1.4 Tue Dec 10 15:18:10 2002 +++ pear/Config/Config/Container/IniCommented.php Tue Dec 17 10:47:00 2002 @@ -15,7 +15,7 @@ // | Author: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: IniCommented.php,v 1.4 2002/12/10 20:18:10 mansion Exp $ +// $Id: IniCommented.php,v 1.5 2002/12/17 15:47:00 mansion Exp $ require_once('Config.php'); @@ -34,7 +34,7 @@ * @param string $datasrc path to the configuration file * @return mixed returns a PEAR_ERROR, if error occurs or true if ok */ - function &parseDatasrc($datasrc) + function &parseDatasrc($datasrc, &$obj) { if (!file_exists($datasrc)) { return PEAR::raiseError("Datasource file does not exist.", null, PEAR_ERROR_RETURN); @@ -42,7 +42,7 @@ $lines = file($datasrc); $n = 0; $lastline = ''; - $currentSection =& $this->container; + $currentSection =& $obj->container; foreach ($lines as $line) { $n++; if (preg_match('/^\s*;(.*?)\s*$/', $line, $match)) { @@ -76,28 +76,28 @@ * @access public * @return string */ - function toString($configType = 'inicommented') + function toString($configType = 'inicommented', $options = array(), &$obj) { if (!isset($string)) { $string = ''; } - switch ($this->type) { + switch ($obj->type) { case 'blank': $string = "\n"; break; case 'comment': - $string = ';'.$this->content."\n"; + $string = ';'.$obj->content."\n"; break; case 'directive': - $string = $this->name.' = '.$this->content."\n"; + $string = $obj->name.' = '.$obj->content."\n"; break; case 'section': - if (!$this->isRoot()) { - $string = '['.$this->name."]\n"; + if (!$obj->isRoot()) { + $string = '['.$obj->name."]\n"; } - if (count($this->children) > 0) { - for ($i = 0; $i < count($this->children); $i++) { - $string .= $this->children[$i]->toString($configType); + if (count($obj->children) > 0) { + for ($i = 0; $i < count($obj->children); $i++) { + $string .= $obj->children[$i]->toString($configType, $options); } } break;

« previous php.pear.cvs (#7913) next »