Config Container : phpIniFile

From: Date: Fri, 14 Jun 2002 04:06:53 +0000
Subject: Config Container : phpIniFile
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7004@lists.php.net to get a copy of this message
Just looking at the Config class: Is there any reason why the IniFile container doesnt use parse_ini_file(), obviously it's going to be alot faster than the current version...?, or is it worth adding an extra Containter phpIniFile.. or FastIniFile..... ** untested code below... The other 'would be nice' on this are $config->getValue() -> aliased as $config->get();
$config->setValue()   -> aliased as $config->set();    $config->parseInput()   -> aliased as $config->parse();    $config->writeInput()   -> aliased as $config->write();    
it's pretty clear what those are likely to do.. otherwise it looks great :) regards Alan the total code difference for Config_Container_IniFile to use parse_ini_file()... $this -> datasrc = $datasrc ; $this -> feature = $feature ; if( !file_exists( $datasrc ) )
       return new PEAR_Error( "File '".$datasrc."' doesn't exists!", 31, PEAR_ERROR_RETURN, null, null );
$array = parse_ini_file($datasrc,TRUE);
   if (!$array)           return new PEAR_Error( "File '".$datasrc."' does not contain configuration data", 31, PEAR_ERROR_RETURN, null, null );
foreach($array) as ($block => $items) {
       if (!$items) continue;
       foreach($items as $key => $value)
       $this->data['/'.$block][$key] = $value;
   }  


« previous php.pear.dev (#7004) next »