class Configuration implements IConfiguration, Iterator
{
private $_items = array();
public function __construct() {
$this->load();
}
protected function load() { }
protected function add( $key, $value ) {
$this->_items[ $key ] = $value;
}
public function get( $key ) {
return $this->_items[ $key ];
}
public function rewind() { reset($this->_items); }
public function current() { return current($this->_items); }
public function key() { return key($this->_items); }
public function next() { return next($this->_items); }
public function valid() { return ( $this->current() !== false ); }
}
class DBConfiguration extends Configuration {
...
}
$c = new DBConfiguration();
foreach( $c as $k => $v ) { echo( $k." = ".$v."\n" ); }
?>