From: Roland Häder Date: Sat, 25 Feb 2023 10:44:05 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a4900758fe2c7fe9ad133e7f5df5ffe9e99e9dd7;p=core.git Continued: - factory-based registries have their own key space --- diff --git a/framework/main/classes/factories/client/class_ClientFactory.php b/framework/main/classes/factories/client/class_ClientFactory.php index 7b912e67..3b182f8f 100644 --- a/framework/main/classes/factories/client/class_ClientFactory.php +++ b/framework/main/classes/factories/client/class_ClientFactory.php @@ -55,9 +55,9 @@ class ClientFactory extends BaseFactory { $registryKey = strtolower($protocolInstance->getProtocolName()) . '_client'; // Is the key already in registry? - if (ObjectRegistry::getRegistry('generic')->instanceExists($registryKey)) { + if (ObjectRegistry::getRegistry('factory')->instanceExists($registryKey)) { // Then use that instance - $clientInstance = ObjectRegistry::getRegistry('generic')->getInstance($registryKey); + $clientInstance = ObjectRegistry::getRegistry('factory')->getInstance($registryKey); // Set socket resource $clientInstance->setSocketResource($socketResource); @@ -66,7 +66,7 @@ class ClientFactory extends BaseFactory { $clientInstance = ObjectFactory::createObjectByConfiguredName($registryKey, array($socketResource)); // Set it in registry for later re-use - ObjectRegistry::getRegistry('generic')->addInstance($registryKey, $clientInstance); + ObjectRegistry::getRegistry('factory')->addInstance($registryKey, $clientInstance); } // Return the prepared instance diff --git a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php index f5fc0bbd..2448c5b5 100644 --- a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php +++ b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php @@ -49,7 +49,7 @@ class DatabaseFrontendFactory extends BaseFactory { */ public static final function createFrontendByConfiguredName (string $frontendName) { // Get registry instance - $registryInstance = ObjectRegistry::getRegistry('generic'); + $registryInstance = ObjectRegistry::getRegistry('factory'); // Do we have an instance in the registry? if ($registryInstance->instanceExists($frontendName)) { diff --git a/framework/main/classes/factories/index/class_FileStackIndexFactory.php b/framework/main/classes/factories/index/class_FileStackIndexFactory.php index e37beb90..aa774a1d 100644 --- a/framework/main/classes/factories/index/class_FileStackIndexFactory.php +++ b/framework/main/classes/factories/index/class_FileStackIndexFactory.php @@ -57,15 +57,15 @@ class FileStackIndexFactory extends BaseFactory { if (empty($type)) { // Throw IAE throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } elseif (ObjectRegistry::getRegistry('generic')->instanceExists($type . '_index')) { + } elseif (ObjectRegistry::getRegistry('factory')->instanceExists($type . '_index')) { // Get handler from registry - $indexInstance = ObjectRegistry::getRegistry('generic')->getInstance($type . '_index'); + $indexInstance = ObjectRegistry::getRegistry('factory')->getInstance($type . '_index'); } else { // Get the handler instance $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', [$fileInfoInstance]); // Add it to the registry - ObjectRegistry::getRegistry('generic')->addInstance($type . '_index', $indexInstance); + ObjectRegistry::getRegistry('factory')->addInstance($type . '_index', $indexInstance); } // Return the instance diff --git a/framework/main/classes/factories/login/class_LoginFactory.php b/framework/main/classes/factories/login/class_LoginFactory.php index dc668de0..f7a2bd37 100644 --- a/framework/main/classes/factories/login/class_LoginFactory.php +++ b/framework/main/classes/factories/login/class_LoginFactory.php @@ -49,7 +49,7 @@ class LoginFactory extends BaseFactory { */ public static final function createLoginObjectByRequest (Requestable $requestInstance) { // Get registry instance - $registryInstance = ObjectRegistry::getRegistry('generic'); + $registryInstance = ObjectRegistry::getRegistry('factory'); // Do we have an instance in the registry? if ($registryInstance->instanceExists('login_helper')) { diff --git a/framework/main/classes/factories/registry/class_SocketRegistryFactory.php b/framework/main/classes/factories/registry/class_SocketRegistryFactory.php index bed3dafa..b527814e 100644 --- a/framework/main/classes/factories/registry/class_SocketRegistryFactory.php +++ b/framework/main/classes/factories/registry/class_SocketRegistryFactory.php @@ -49,7 +49,7 @@ class SocketRegistryFactory extends BaseFactory { */ public static final function createSocketRegistryInstance () { // Get registry instance - $registryInstance = ObjectRegistry::getRegistry('generic'); + $registryInstance = ObjectRegistry::getRegistry('factory'); // Do we have an instance in the registry? if ($registryInstance->instanceExists('socket_registry')) { diff --git a/framework/main/classes/factories/stacks/class_FileStackFactory.php b/framework/main/classes/factories/stacks/class_FileStackFactory.php index 92a5158b..32d6326f 100644 --- a/framework/main/classes/factories/stacks/class_FileStackFactory.php +++ b/framework/main/classes/factories/stacks/class_FileStackFactory.php @@ -73,15 +73,15 @@ class FileStackFactory extends BaseFactory { )); // If there is no handler? - if (ObjectRegistry::getRegistry('generic')->instanceExists($stackName . '_stack')) { + if (ObjectRegistry::getRegistry('factory')->instanceExists($stackName . '_stack')) { // Get handler from registry - $stackInstance = ObjectRegistry::getRegistry('generic')->getInstance($stackName . '_stack'); + $stackInstance = ObjectRegistry::getRegistry('factory')->getInstance($stackName . '_stack'); } else { // Get the handler instance $stackInstance = ObjectFactory::createObjectByConfiguredName($prefix . '_' . $stackName . '_stack_class', array($fileInfoInstance, $prefix . '_' . $stackName)); // Add it to the registry - ObjectRegistry::getRegistry('generic')->addInstance($stackName . '_stack', $stackInstance); + ObjectRegistry::getRegistry('factory')->addInstance($stackName . '_stack', $stackInstance); } // Return the instance diff --git a/framework/main/classes/factories/user/class_UserFactory.php b/framework/main/classes/factories/user/class_UserFactory.php index 6fc42a6c..9aeb0588 100644 --- a/framework/main/classes/factories/user/class_UserFactory.php +++ b/framework/main/classes/factories/user/class_UserFactory.php @@ -49,7 +49,7 @@ class UserFactory extends BaseFactory { */ public static final function createUserByRequest (Requestable $requestInstance) { // Get registry instance - $registryInstance = ObjectRegistry::getRegistry('generic'); + $registryInstance = ObjectRegistry::getRegistry('factory'); // Do we have an instance in the registry? if ($registryInstance->instanceExists('user')) { diff --git a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php index 18b85097..f29e271b 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -63,9 +63,9 @@ class XmlTemplateEngineFactory extends BaseFactory { } // Do we have an instance in the registry? - if (ObjectRegistry::getRegistry('generic')->instanceExists($configKey)) { + if (ObjectRegistry::getRegistry('factory')->instanceExists($configKey)) { // Then use this instance - $templateInstance = ObjectRegistry::getRegistry('generic')->getInstance($configKey); + $templateInstance = ObjectRegistry::getRegistry('factory')->getInstance($configKey); } else { // Get the XML template instance $templateInstance = ObjectFactory::createObjectByConfiguredName($configKey); @@ -80,7 +80,7 @@ class XmlTemplateEngineFactory extends BaseFactory { $templateInstance->enableXmlCompacting(); // Set the instance in registry for further use - ObjectRegistry::getRegistry('generic')->addInstance($configKey, $templateInstance); + ObjectRegistry::getRegistry('factory')->addInstance($configKey, $templateInstance); } // Return the instance