cvs: pear /Config/Config/Container IniFile.php
| From: | Bertrand Mansion | Date: | Tue, 17 Dec 2002 15:44:07 +0000 |
| Subject: | cvs: pear /Config/Config/Container IniFile.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7912@lists.php.net to get a copy of this message | ||
mansion Tue Dec 17 10:44:07 2002 EDT
Modified files:
/pear/Config/Config/Container IniFile.php
Log:
Add reference to config object as parameter because of ::
Index: pear/Config/Config/Container/IniFile.php
diff -u pear/Config/Config/Container/IniFile.php:1.7 pear/Config/Config/Container/IniFile.php:1.8
--- pear/Config/Config/Container/IniFile.php:1.7 Wed Nov 27 12:04:06 2002
+++ pear/Config/Config/Container/IniFile.php Tue Dec 17 10:44:06 2002
@@ -15,7 +15,7 @@
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: IniFile.php,v 1.7 2002/11/27 17:04:06 mansion Exp $
+// $Id: IniFile.php,v 1.8 2002/12/17 15:44:06 mansion Exp $
require_once('Config.php');
@@ -35,19 +35,19 @@
* @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);
}
- $currentSection =& $this->container;
+ $currentSection =& $obj->container;
$confArray = parse_ini_file($datasrc, true);
if (!$confArray) {
return PEAR::raiseError("File '$datasrc' does not contain configuration
data.", null, PEAR_ERROR_RETURN);
}
foreach ($confArray as $key => $value) {
if (is_array($value)) {
- $currentSection =& $this->container->createSection($key);
+ $currentSection =& $obj->container->createSection($key);
foreach ($value as $directive => $content) {
$currentSection->createDirective($directive, $content);
}
@@ -63,22 +63,22 @@
* @access public
* @return string
*/
- function toString($configType = 'inifile')
+ function toString($configType = 'inifile', $options = array(), &$obj)
{
if (!isset($string)) {
$string = '';
}
- switch ($this->type) {
+ switch ($obj->type) {
case 'directive':
- $string = $this->name.' = '.$this->content."\n";
+ $string = $obj->name.' = '.$obj->content."\n";
break;
case 'section':
- if (!is_null($this->parent)) {
- $string = '['.$this->name."]\n";
+ if (!is_null($obj->parent)) {
+ $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;