$userInstance = null;
// Get a registry instance
- $registry = Registry::getInstance();
+ $registry = Registry::getRegistry();
// Is the user already there?
if ($registry->instanceExists('user')) {
$userInstance = null;
// Get a registry instance
- $registry = Registry::getInstance();
+ $registry = Registry::getRegistry();
// Is the user already there?
if ($registry->instanceExists('user')) {
*
* @return $selfInstance Instance of this class
*/
- public final static function getInstance () {
+ public final static function getRegistry () {
// Is an instance there?
if (is_null(self::$selfInstance)) {
// Not yet, so create one
public function addInstance ($instanceKey, Registerable $objectInstance) {
$this->instanceRegistry[$instanceKey] = $objectInstance;
}
+
+ /**
+ * Gets a registered instance or null if not found
+ *
+ * @param $instanceKey The key to identify the instance
+ * @return $objectInstance An instance we shall store
+ */
+ public function getInstance ($instanceKey) {
+ // By default the instance is not in the registry
+ $objectInstance = null;
+
+ // Is the instance there?
+ if ($this->instanceExists($instanceKey)) {
+ $objectInstance = $this->instanceRegistry[$instanceKey];
+ }
+
+ // Return the result
+ return $objectInstance;
+ }
}
// [EOF]
*
* @return $exists Wether the username exists
*/
- protected function ifUsernameExists () {
+ public function ifUsernameExists () {
// By default the username does exist
$exists = true;