[eluser]tomcode[/eluser]
I'll keep the config file as plain data holder, no code, the model call probably won't work anyway.
You could do :
Code:
class Paypal_ap {
var $defaults = array('x', 'y');
var $x = NULL;
var $y = NULL;
var $z = NULL;
function Paypal_ap($params = array())
{
$this->initialize($params);
}
function initialize($params = array())
{
foreach($params as $key => $param)
{
if(isset($this->$key))
{
$this->$key = $param;
}
}
}
function reset()
{
$CI =& get_instance();
$values = array();
foreach($this->defaults as $key)
{
$values[$key] = $CI->config->item($key);
}
$this->initialize($values);
}
}
Now You can have a fully automated run, You can set values from the controller and You have a convenience function to easily return to a default state.