Registry class question.
| From: | Peter van der Does | Date: | Fri, 26 Feb 2010 20:17:53 +0000 |
| Subject: | Registry class question. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-302409@lists.php.net to get a copy of this message | ||
Hi,
I've build a registry class to store settings I need to use in several
other classes.
Currently I've set it up with a static array in the registry class and
using two methods to access the settings and values
storeSetting($key,$value) {
$this->_settings[$key] = $value;
}
getSetting($key) {
return $this->_settings[$key];
}
The question is what the pros and cons are compared to setting a new
property with the value, like:
storeSetting($key,$value) {
$this->$key = $value;
}
and then instead of calling getSetting, you just use
$this->Registry->property
--
Peter van der Does
GPG key: E77E8E98
IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes
WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware