]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/registry/connection/class_ConnectionRegistry.php
A lot changes for refacturing protocol handler
[hub.git] / application / hub / main / registry / connection / class_ConnectionRegistry.php
index fb7745fc41b03b4c0199e4eae803132b382add36..2caf8fc76c882cdc17fab6acd57113bf7841b526 100644 (file)
@@ -58,17 +58,17 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
 
        /**
         * "Getter" to get a string respresentation for a key for the sub-registry
-        * in this format: class:protocol:port
+        * in this format: class:type:port
         *
         * @param       $connectionInstance             An instance of a ConnectionHelper class
         * @return      $key                                    A string representation of the socket for the registry
         */
        private function getSubRegistryKey (ConnectionHelper $connectionInstance) {
-               // Get protocol and port number and add both together
-               $key = sprintf("%s:%s:%s",
+               // Get connection type and port number and add both together
+               $key = sprintf('%s:%s:%s',
                        $connectionInstance->__toString(),
-                       $connectionInstance->getProtocolName(),
-                       $connectionInstance->getPort()
+                       $connectionInstance->getConnectionType(),
+                       $connectionInstance->getConnectionPort()
                );
 
                // Return resulting key
@@ -78,10 +78,10 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
        /**
         * "Getter" to get a string respresentation of the protocol
         *
-        * @param       $connectionInstance     An instance of a ConnectionHelper class
-        * @return      $key                            A string representation of the protocol for the registry
+        * @param       $connectionInstance             An instance of a ConnectionHelper class
+        * @return      $key                                    A string representation of the protocol for the registry
         */
-       private function getRegistryKeyFromProtocol (ConnectionHelper $connectionInstance) {
+       private function getRegistryKeyFromConnection (ConnectionHelper $connectionInstance) {
                // Get the key
                $key = $connectionInstance->getProtocolName();
 
@@ -95,9 +95,9 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
         * @param       $connectionInstance     An instance of a ConnectionHelper class
         * @return      $isRegistered           Whether the protocol is registered
         */
-       private function isProtocolRegistered (ConnectionHelper $connectionInstance) {
+       private function isConnectionRegistered (ConnectionHelper $connectionInstance) {
                // Get the key
-               $key = $this->getRegistryKeyFromProtocol($connectionInstance);
+               $key = $this->getRegistryKeyFromConnection($connectionInstance);
 
                // Determine it
                $isRegistered = $this->instanceExists($key);
@@ -119,9 +119,9 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
                $isRegistered = FALSE;
 
                // First, check for the instance, there can be only once
-               if ($this->isProtocolRegistered($connectionInstance)) {
+               if ($this->isConnectionRegistered($connectionInstance)) {
                        // That one is found so "get" a registry key from it
-                       $key = $this->getRegistryKeyFromProtocol($connectionInstance);
+                       $key = $this->getRegistryKeyFromConnection($connectionInstance);
 
                        // Get the registry
                        $registryInstance = $this->getInstance($key);
@@ -154,15 +154,15 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
                } // END - if
 
                // Does the instance exist?
-               if (!$this->isProtocolRegistered($connectionInstance)) {
+               if (!$this->isConnectionRegistered($connectionInstance)) {
                        // No, not found so we create a sub registry (not needed to configure!)
                        $registryInstance = SubRegistry::createSubRegistry();
 
                        // Now we can create the sub-registry for this protocol
-                       $this->addInstance($this->getRegistryKeyFromProtocol($connectionInstance), $registryInstance);
+                       $this->addInstance($this->getRegistryKeyFromConnection($connectionInstance), $registryInstance);
                } else {
                        // Get the sub-registry back
-                       $registryInstance = $this->getInstance($this->getRegistryKeyFromProtocol($connectionInstance));
+                       $registryInstance = $this->getInstance($this->getRegistryKeyFromConnection($connectionInstance));
                }
 
                // Get a key for sub-registries
@@ -191,7 +191,7 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
                } // END - if
 
                // Now get the key from the protocol
-               $key = $this->getRegistryKeyFromProtocol($connectionInstance);
+               $key = $this->getRegistryKeyFromConnection($connectionInstance);
 
                // And get the registry
                $registryInstance = $this->getInstance($key);