Added new factory and fixed confusing between login and actual user classes.
[core.git] / inc / classes / main / factories / login / class_LoginFactory.php
index 01b042c..0f27199 100644 (file)
@@ -36,7 +36,7 @@ class LoginFactory extends ObjectFactory {
         * Returns a singleton login instance for given request instance.
         *
         * @param       $requestInstance        An instance of a Requestable class
-        * @return      $wrapperInstance        A database wrapper instance
+        * @return      $loginInstance          An instance of a login helper (@TODO Use actual interface name)
         */
        public static final function createLoginObjectByRequest (Requestable $requestInstance) {
                // Get registry instance
@@ -45,29 +45,29 @@ class LoginFactory extends ObjectFactory {
                // Do we have an instance in the registry?
                if ($registryInstance->instanceExists('login_helper')) {
                        // Then use this instance
-                       $userInstance = $registryInstance->getInstance('login_helper');
+                       $loginInstance = $registryInstance->getInstance('login_helper');
                } else {
                        // Probe on member instance
                        try {
                                // Get class name
-                               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry('user_class');
+                               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry('user_login_class');
 
                                // Try to instance it
-                               $userInstance = call_user_func_array(array($className, 'createMemberByRequest'), array($requestInstance));
+                               $loginInstance = call_user_func_array(array($className, 'createMemberByRequest'), array($requestInstance));
                        } catch (UnexpectedGuestAccountException $e) {
                                // Then try it with guest account
-                               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry('guest_class');
+                               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry('guest_login_class');
 
                                // Try to instance it
-                               $userInstance = call_user_func_array(array($className, 'createGuestByRequest'), array($requestInstance));
+                               $loginInstance = call_user_func_array(array($className, 'createGuestByRequest'), array($requestInstance));
                        }
 
                        // Set the instance in registry for further use
-                       $registryInstance->addInstance('login_helper', $userInstance);
+                       $registryInstance->addInstance('login_helper', $loginInstance);
                }
 
                // Return the instance
-               return $userInstance;
+               return $loginInstance;
        }
 }