]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/factories/client/class_ClientFactory.php
Continued:
[core.git] / framework / main / classes / factories / client / class_ClientFactory.php
index 5da193dc851584269dec45a25d4ad0ae45d20603..3b182f8f7135c9cb99d853fc2014744f615dde34 100644 (file)
@@ -1,17 +1,17 @@
 <?php
 // Own namespace
-namespace CoreFramework\Factory\Client;
+namespace Org\Mxchange\CoreFramework\Factory\Client;
 
 // Import framework stuff
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Factory\BaseFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 
 /**
  * An object factory for clients
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -28,13 +28,13 @@ use CoreFramework\Registry\Registry;
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class ClientFactory extends ObjectFactory {
+class ClientFactory extends BaseFactory {
        /**
         * Protected constructor
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -47,7 +47,7 @@ class ClientFactory extends ObjectFactory {
         * @param       $socketResource         A valid socket resource (optional)
         * @return      $clientInstance         An instance of the requested client
         */
-       public static final function createClientByProtocolInstance (HandleableProtocol $protocolInstance, $socketResource = false) {
+       public static final function createClientByProtocolInstance (HandleableProtocol $protocolInstance, $socketResource = FALSE) {
                // Default is NULL (to initialize variable)
                $clientInstance = NULL;
 
@@ -55,18 +55,18 @@ class ClientFactory extends ObjectFactory {
                $registryKey = strtolower($protocolInstance->getProtocolName()) . '_client';
 
                // Is the key already in registry?
-               if (Registry::getRegistry()->instanceExists($registryKey)) {
+               if (ObjectRegistry::getRegistry('factory')->instanceExists($registryKey)) {
                        // Then use that instance
-                       $clientInstance = Registry::getRegistry()->getInstance($registryKey);
+                       $clientInstance = ObjectRegistry::getRegistry('factory')->getInstance($registryKey);
 
                        // Set socket resource
                        $clientInstance->setSocketResource($socketResource);
                } else {
                        // Generate object instance
-                       $clientInstance = self::createObjectByConfiguredName($registryKey, array($socketResource));
+                       $clientInstance = ObjectFactory::createObjectByConfiguredName($registryKey, array($socketResource));
 
                        // Set it in registry for later re-use
-                       Registry::getRegistry()->addInstance($registryKey, $clientInstance);
+                       ObjectRegistry::getRegistry('factory')->addInstance($registryKey, $clientInstance);
                }
 
                // Return the prepared instance