]> git.mxchange.org Git - shipsimu.git/commitdiff
Access level fixed, registry is able to return instances
authorRoland Häder <roland@mxchange.org>
Mon, 2 Jun 2008 18:19:40 +0000 (18:19 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 2 Jun 2008 18:19:40 +0000 (18:19 +0000)
inc/classes/main/filter/validator/class_EmailValidatorFilter.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/classes/main/registry/class_Registry.php
inc/classes/main/user/class_User.php

index 8d9117bd89460dba4bfc13b609b9ecba9f1d8db6..37e207d7b373a8abe83f317594f04fec419af862 100644 (file)
@@ -139,7 +139,7 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
                $userInstance = null;
 
                // Get a registry instance
-               $registry = Registry::getInstance();
+               $registry = Registry::getRegistry();
 
                // Is the user already there?
                if ($registry->instanceExists('user')) {
index 38471cdecb248553e631194a19bdcd18724a68b5..85ddfbe187e191f17139516dad4948ea1eb0a94d 100644 (file)
@@ -114,7 +114,7 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
                $userInstance = null;
 
                // Get a registry instance
-               $registry = Registry::getInstance();
+               $registry = Registry::getRegistry();
 
                // Is the user already there?
                if ($registry->instanceExists('user')) {
index 0ceda2c0c4016ebd04830884fd93aff9770d1ecf..3d3c8cab9891c71efebe9f9de21143736e8684f6 100644 (file)
@@ -57,7 +57,7 @@ class Registry extends BaseFrameworkSystem implements Register {
         *
         * @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
@@ -92,6 +92,25 @@ class Registry extends BaseFrameworkSystem implements Register {
        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]
index 05afd6dab226b11a4c7530e081af2d96301fe813..564d0ecf21e652ccf63c3ed54fbf4d1a5631d212 100644 (file)
@@ -145,7 +145,7 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
         *
         * @return      $exists         Wether the username exists
         */
-       protected function ifUsernameExists () {
+       public function ifUsernameExists () {
                // By default the username does exist
                $exists = true;