cvs: pear /Config/Config Container.php

From: Date: Tue, 17 Dec 2002 17:12:30 +0000
Subject: cvs: pear /Config/Config Container.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7918@lists.php.net to get a copy of this message
mansion Tue Dec 17 12:12:30 2002 EDT Modified files: /pear/Config/Config Container.php Log: Completed implementation of writeDatasrc Index: pear/Config/Config/Container.php diff -u pear/Config/Config/Container.php:1.10 pear/Config/Config/Container.php:1.11 --- pear/Config/Config/Container.php:1.10 Tue Dec 17 11:52:37 2002 +++ pear/Config/Config/Container.php Tue Dec 17 12:12:30 2002 @@ -15,7 +15,7 @@ // | Author: Bertrand Mansion <bmansion@mamasam.com> | // +---------------------------------------------------------------------+ // -// $Id: Container.php,v 1.10 2002/12/17 16:52:37 mansion Exp $ +// $Id: Container.php,v 1.11 2002/12/17 17:12:30 mansion Exp $ require_once('Config.php'); @@ -438,10 +438,11 @@ } // end func isRoot /** - * Interface method + * Call the toString methods in the container plugin * @param string configType Type of configuration used to generate the string + * @param array options (optional)specify special options used by the parser * @access public - * @return null + * @return true on success or PEAR_ERROR */ function toString($configType = '', $options = array()) { @@ -503,10 +504,11 @@ * @access public * @return PEAR_ERROR or true */ - function writeDatasrc($datasrc, $configType = '') + function writeDatasrc($datasrc, $configType = '', $options = array()) { - // Check for a writeDatasrc method in plugin - /* NOT YET FULLY IMPLEMENTED + // Check for a writeDatasrc($datasrc, $configType, $options, &$obj) method in plugin + // untested ! + $configType = strtolower($configType); if (!Config::isConfigTypeRegistered($configType)) { return PEAR::raiseError("Configuration type '$configType' is not registered in Config_Container::writeDatasrc.", null, PEAR_ERROR_RETURN); @@ -516,14 +518,13 @@ include_once($includeFile); if (in_array('writeDatasrc', get_class_methods($className))) { - return eval("return $className::writeDatasrc('$configType');"); + return call_user_func(array($className, 'writeDatasrc'), $datasrc, $configType, $options, $this); } - */ // Default behaviour $fp = @fopen($datasrc, 'w'); if ($fp) { - $string = $this->toString($configType); + $string = $this->toString($configType, $options); $len = strlen($string); @flock($fp, LOCK_EX); @fwrite($fp, $string, $len);

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