cvs: pear /Auth_PrefManager2 PrefManager2.php
| From: | Jon Wood | Date: | Tue, 29 Jun 2004 12:30:48 +0000 |
| Subject: | cvs: pear /Auth_PrefManager2 PrefManager2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21246@lists.php.net to get a copy of this message | ||
jellybob Tue Jun 29 08:30:48 2004 EDT
Modified files:
/pear/Auth_PrefManager2 PrefManager2.php
Log:
Moved setting defaults into a protected method which containers can override.
http://cvs.php.net/diff.php/pear/Auth_PrefManager2/PrefManager2.php?r1=1.3&r2=1.4&ty=u
Index: pear/Auth_PrefManager2/PrefManager2.php
diff -u pear/Auth_PrefManager2/PrefManager2.php:1.3 pear/Auth_PrefManager2/PrefManager2.php:1.4
--- pear/Auth_PrefManager2/PrefManager2.php:1.3 Tue Jun 29 08:27:01 2004
+++ pear/Auth_PrefManager2/PrefManager2.php Tue Jun 29 08:30:48 2004
@@ -15,7 +15,7 @@
// | Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
//
-// $Id: PrefManager2.php,v 1.3 2004/06/29 12:27:01 jellybob Exp $
+// $Id: PrefManager2.php,v 1.4 2004/06/29 12:30:48 jellybob Exp $
/**
* Used for error handling.
@@ -103,15 +103,7 @@
function Auth_PrefManager2($options = array())
{
$this->_errorStack =& PEAR_ErrorStack::singleton('Auth_PrefManager2');
-
- if (!isset($options['default_user'])) $options['default_user'] =
'default';
- if (!isset($options['default_app'])) $options['default_app'] =
'default';
- if (!isset($options['serialize'])) $options['serialize'] = true;
- if (!isset($options['cache'])) $options['cache'] = true;
- if (!isset($options['cache_key'])) $options['cache_key'] =
'_prefmanager2';
- if (!isset($options['debug'])) $options['debug'] = false;
-
- $this->_options = $options;
+ $this->_parseOptions($options);
}
/**
@@ -345,6 +337,46 @@
}
return $value;
+ }
+
+ /**
+ * Reads the options array, and sets default values for anything
+ * which isn't set.
+ *
+ * Container classes should override this method, set any defaults
+ * that they need, and then pass the options to parent::_parseOptions().
+ *
+ * @param array $options An array of options.
+ * @return void
+ * @access protected
+ */
+ function _parseOptions($options)
+ {
+ if (!isset($options['default_user'])) {
+ $options['default_user'] = 'default';
+ }
+
+ if (!isset($options['default_app'])) {
+ $options['default_app'] = 'default';
+ }
+
+ if (!isset($options['serialize'])) {
+ $options['serialize'] = true;
+ }
+
+ if (!isset($options['cache'])) {
+ $options['cache'] = true;
+ }
+
+ if (!isset($options['cache_key'])) {
+ $options['cache_key'] = '_prefmanager2';
+ }
+
+ if (!isset($options['debug'])) {
+ $options['debug'] = false;
+ }
+
+ $this->_options = $options;
}
/**