Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 25 Feb 2023 09:34:42 +0000 (10:34 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 25 Feb 2023 09:34:42 +0000 (10:34 +0100)
- getRegistry() now have a mandatory parameter

36 files changed:
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/commands/html/class_HtmlConfirmCommand.php
framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php
framework/main/classes/commands/html/class_HtmlLoginCommand.php
framework/main/classes/commands/html/class_HtmlRegisterCommand.php
framework/main/classes/commands/html/class_HtmlResendLinkCommand.php
framework/main/classes/controller/class_BaseController.php
framework/main/classes/factories/client/class_ClientFactory.php
framework/main/classes/factories/database/class_DatabaseFrontendFactory.php
framework/main/classes/factories/index/class_FileStackIndexFactory.php
framework/main/classes/factories/login/class_LoginFactory.php
framework/main/classes/factories/registry/class_SocketRegistryFactory.php
framework/main/classes/factories/stacks/class_FileStackFactory.php
framework/main/classes/factories/user/class_UserFactory.php
framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php
framework/main/classes/filter/auth/class_UserAuthFilter.php
framework/main/classes/filter/change/class_EmailChangeFilter.php
framework/main/classes/filter/change/class_PasswordChangeFilter.php
framework/main/classes/filter/news/class_NewsDownloadFilter.php
framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php
framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php
framework/main/classes/filter/update/class_UserUpdateFilter.php
framework/main/classes/filter/validator/class_EmailValidatorFilter.php
framework/main/classes/filter/validator/class_UserNameValidatorFilter.php
framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php
framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php
framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php
framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php
framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php
framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php
framework/main/classes/helper/class_BaseHelper.php
framework/main/classes/helper/html/forms/class_HtmlFormHelper.php
framework/main/classes/registry/class_
framework/main/classes/registry/generic/class_GenericRegistry.php
framework/main/classes/registry/object/class_ObjectRegistry.php
framework/main/tests/commands/console/class_TestsConsoleMainCommand.php

index 79380a2337995bf63140f6fafd2f1ea9b486b41a..431c3a1032765cb4283237c39f6cc3959b51979a 100644 (file)
@@ -417,7 +417,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         * @return      void
         */
        public final function setWebOutputInstance (OutputStreamer $webInstance) {
-               ObjectRegistry::getRegistry()->addInstance('web_output', $webInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('web_output', $webInstance);
        }
 
        /**
@@ -426,7 +426,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac
         * @return      $webOutputInstance - Instance to class WebOutput
         */
        public final function getWebOutputInstance () {
-               return ObjectRegistry::getRegistry()->getInstance('web_output');
+               return ObjectRegistry::getRegistry('generic')->getInstance('web_output');
        }
 
        /**
index 93eee3bbcfafcc9e3edacb74dbcd7fd3b7ab0c64..79f8bdf4968ebe6d0626adf0712d2f77a3218d2d 100644 (file)
@@ -114,7 +114,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable {
 
                // Get user instance
                try {
-                       $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+                       $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
                } catch (NullPointerException $e) {
                        // Not found user, e.g. when the user is somehow invalid
                        $responseInstance->redirectToConfiguredUrl('html_cmd_user_is_null');
index 0b122fe2187e58275eb8aa0a90d0a73ee495d7e1..0c59b7ef3122ca5e1a89fbd47fce9122925b1949 100644 (file)
@@ -92,7 +92,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the action instance from registry
-               $actionInstance = ObjectRegistry::getRegistry()->getInstance('action');
+               $actionInstance = ObjectRegistry::getRegistry('generic')->getInstance('action');
 
                // Do we have an action here?
                if ($actionInstance instanceof PerformableAction) {
@@ -200,7 +200,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable {
                $actionInstance->addExtraFilters($controllerInstance, $requestInstance);
 
                // Remember this action in registry
-               ObjectRegistry::getRegistry()->addInstance('action', $actionInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('action', $actionInstance);
        }
 
 }
index 2c6527360528f54326bc66de477677cf047f6e69..bea535beb0a73dfda0d0990b4c5efac3b2799b3b 100644 (file)
@@ -73,7 +73,7 @@ class HtmlLoginCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Set request instance as extra instance
-               ObjectRegistry::getRegistry()->addInstance('extra', $this);
+               ObjectRegistry::getRegistry('generic')->addInstance('extra', $this);
 
                // Get the application instance
                $applicationInstance = ApplicationHelper::getSelfInstance();
index a805930cde85c576c38b2028a7e6234e21c8df95..56b2608516f83b0599696dffa59a14d8b1b556d8 100644 (file)
@@ -73,7 +73,7 @@ class HtmlRegisterCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Set request instance as extra instance
-               ObjectRegistry::getRegistry()->addInstance('extra', $this);
+               ObjectRegistry::getRegistry('generic')->addInstance('extra', $this);
 
                // Get the application instance
                $applicationInstance = ApplicationHelper::getSelfInstance();
index dd0b683edfe1f7128a9fd3ed96f2d2a7a389eb5a..ebb2c5d3dab78b25f340e47d6928b65451b4c933 100644 (file)
@@ -74,7 +74,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get user instance from registry
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Get an application instance
                $applicationInstance = ApplicationHelper::getSelfInstance();
index 8067fcbafe7094a712c28b08acad194a297d6f36..2535df01a1cd7c66cb368b1f1c51a6e8403c4a21 100644 (file)
@@ -68,7 +68,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl
                $this->initFilterChain(self::FILTER_CHAIN_POST_COMMAND);
 
                // Add this controller to the registry
-               ObjectRegistry::getRegistry()->addInstance('controller', $this);
+               ObjectRegistry::getRegistry('generic')->addInstance('controller', $this);
        }
 
        /**
index 19248724641d73e6f6bf160125deb00fb2e4770e..7b912e67211c63e3b036a09b0c71ba4864ce133e 100644 (file)
@@ -55,9 +55,9 @@ class ClientFactory extends BaseFactory {
                $registryKey = strtolower($protocolInstance->getProtocolName()) . '_client';
 
                // Is the key already in registry?
-               if (ObjectRegistry::getRegistry()->instanceExists($registryKey)) {
+               if (ObjectRegistry::getRegistry('generic')->instanceExists($registryKey)) {
                        // Then use that instance
-                       $clientInstance = ObjectRegistry::getRegistry()->getInstance($registryKey);
+                       $clientInstance = ObjectRegistry::getRegistry('generic')->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()->addInstance($registryKey, $clientInstance);
+                       ObjectRegistry::getRegistry('generic')->addInstance($registryKey, $clientInstance);
                }
 
                // Return the prepared instance
index 90ea3e2e40a09c6091e727d141262e08c9c2f306..f5fc0bbd7a649053b49847af8a07c3396cabf815 100644 (file)
@@ -49,7 +49,7 @@ class DatabaseFrontendFactory extends BaseFactory {
         */
        public static final function createFrontendByConfiguredName (string $frontendName) {
                // Get registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Do we have an instance in the registry?
                if ($registryInstance->instanceExists($frontendName)) {
index ad29daa3fd27b2989a6edc5c88dcc09e93e6881a..e37beb907fb3cb514f8053fd023fec089aabcf30 100644 (file)
@@ -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()->instanceExists($type . '_index')) {
+               } elseif (ObjectRegistry::getRegistry('generic')->instanceExists($type . '_index')) {
                        // Get handler from registry
-                       $indexInstance = ObjectRegistry::getRegistry()->getInstance($type . '_index');
+                       $indexInstance = ObjectRegistry::getRegistry('generic')->getInstance($type . '_index');
                } else {
                        // Get the handler instance
                        $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', [$fileInfoInstance]);
 
                        // Add it to the registry
-                       ObjectRegistry::getRegistry()->addInstance($type . '_index', $indexInstance);
+                       ObjectRegistry::getRegistry('generic')->addInstance($type . '_index', $indexInstance);
                }
 
                // Return the instance
index f668e726ba6094f07fe34951a01c4bdf947e63bc..dc668de0410e42cb0dfad561a9b6d2a9cf3c31ea 100644 (file)
@@ -49,7 +49,7 @@ class LoginFactory extends BaseFactory {
         */
        public static final function createLoginObjectByRequest (Requestable $requestInstance) {
                // Get registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Do we have an instance in the registry?
                if ($registryInstance->instanceExists('login_helper')) {
index 13cc619a79955fd4e5af9f0bdcbcf073e41b1a43..bed3dafa778a245122268731ba10b0b882560364 100644 (file)
@@ -49,7 +49,7 @@ class SocketRegistryFactory extends BaseFactory {
         */
        public static final function createSocketRegistryInstance () {
                // Get registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Do we have an instance in the registry?
                if ($registryInstance->instanceExists('socket_registry')) {
index 9691a6ed7d135ffb0e59e45719b4ab1d32e55aba..92a5158bb573b57d7aa5dc64862b09d21e3ff1da 100644 (file)
@@ -73,15 +73,15 @@ class FileStackFactory extends BaseFactory {
                ));
 
                // If there is no handler?
-               if (ObjectRegistry::getRegistry()->instanceExists($stackName . '_stack')) {
+               if (ObjectRegistry::getRegistry('generic')->instanceExists($stackName . '_stack')) {
                        // Get handler from registry
-                       $stackInstance = ObjectRegistry::getRegistry()->getInstance($stackName . '_stack');
+                       $stackInstance = ObjectRegistry::getRegistry('generic')->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()->addInstance($stackName . '_stack', $stackInstance);
+                       ObjectRegistry::getRegistry('generic')->addInstance($stackName . '_stack', $stackInstance);
                }
 
                // Return the instance
index 4582152545dd911196e8c44fb3da9eef6ac4a1bb..6fc42a6c6c6cefc67bcf03cb7db1d8a1afa1de43 100644 (file)
@@ -49,7 +49,7 @@ class UserFactory extends BaseFactory {
         */
        public static final function createUserByRequest (Requestable $requestInstance) {
                // Get registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Do we have an instance in the registry?
                if ($registryInstance->instanceExists('user')) {
index f6b5bda63057f056e847ad5f7c15b8dd3b8d192f..18b85097994e65957e06d42761d5fbd3f4fddd85 100644 (file)
@@ -63,9 +63,9 @@ class XmlTemplateEngineFactory extends BaseFactory {
                }
 
                // Do we have an instance in the registry?
-               if (ObjectRegistry::getRegistry()->instanceExists($configKey)) {
+               if (ObjectRegistry::getRegistry('generic')->instanceExists($configKey)) {
                        // Then use this instance
-                       $templateInstance = ObjectRegistry::getRegistry()->getInstance($configKey);
+                       $templateInstance = ObjectRegistry::getRegistry('generic')->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()->addInstance($configKey, $templateInstance);
+                       ObjectRegistry::getRegistry('generic')->addInstance($configKey, $templateInstance);
                }
 
                // Return the instance
index d909bd214dd4233c42a28a223eed5187b70a76cd..41d9b135a71d89ecaaebc1d1e1fe528c38653bf1 100644 (file)
@@ -140,8 +140,8 @@ class UserAuthFilter extends BaseFilter implements Filterable {
                }
 
                // Remember auth and user instances in registry
-               ObjectRegistry::getRegistry()->addInstance('auth', $authInstance);
-               ObjectRegistry::getRegistry()->addInstance('user', $userInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('auth', $authInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('user', $userInstance);
        }
 
 }
index 25e4729db57e220878c1cdd7b2be0f3e3fbdbbd1..dcde36f10c10db11d1e418b3f19d9a122f426ded 100644 (file)
@@ -114,7 +114,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable {
                }
 
                // Now, get a user instance for comparison
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Get the email field
                $userEmail = $userInstance->getField('email');
index 8a011d0788521cd5d30742fd3175873a6bd7f435..4d878637b32a1ffe7c6e6f65fca37fef34a90239 100644 (file)
@@ -115,7 +115,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable {
                }
 
                // Now, get a user instance for comparison
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Update the "password" field
                DebugMiddleware::getSelfInstance()->partialStub('Unfinished part.');
index c4323697548a7cee54d4c775da45675485f8822d..0737f283285220c13e6c6652d24ac7452e66e0c4 100644 (file)
@@ -48,7 +48,7 @@ class NewsDownloadFilter extends BaseFilter implements Filterable {
        /**
         * Creates an instance of this filter class
         *
-        * @return      $filterInstance                 An instance of this filter class
+        * @return      $filterInstance         An instance of this filter class
         */
        public static final function createNewsDownloadFilter () {
                // Get a new instance
@@ -70,7 +70,7 @@ class NewsDownloadFilter extends BaseFilter implements Filterable {
                $newsInstance = HtmlNewsFactory::createFactoryByRequest($requestInstance);
 
                // Store the news instance in registry
-               ObjectRegistry::getRegistry()->addInstance('news', $newsInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('news', $newsInstance);
        }
 
 }
index c89e7d312dc7d461c0eb4c86e098dc8526ab64ae..7299f4f7f13782cd0ebf9b8caaba2d63db2677b6 100644 (file)
@@ -123,7 +123,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable {
                        $discoveryInstance->discover($requestInstance);
 
                        // Remember this instance if all wents fine
-                       ObjectRegistry::getRegistry()->addInstance('payments', $discoveryInstance);
+                       ObjectRegistry::getRegistry('generic')->addInstance('payments', $discoveryInstance);
                } catch (NoConfigEntryException $e) {
                        // Something bad happend
                        $requestInstance->setIsRequestValid(FALSE);
index 5d2f1e3589eccc92994bf9c9173b6cc30f8e26a4..e94a6ba0c50dce703ffd5b02cfae41511b00c6af 100644 (file)
@@ -66,7 +66,7 @@ class UserStatusConfimedUpdateFilter extends BaseFilter implements Filterable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get user instance from registry
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Get "confirmed" status from config
                $confirmed = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_confirmed');
index cf93249722cc3717ea10c74e095b5f8cee6b5532..ac688fd83da1368d06fe0f3c212332b9531429ce 100644 (file)
@@ -66,13 +66,13 @@ class UserUpdateFilter extends BaseFilter implements Filterable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get user instance from registry
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Now update last activity
                $userInstance->updateLastActivity($requestInstance);
 
                // Update auth data as well
-               $authInstance = ObjectRegistry::getRegistry()->getInstance('auth');
+               $authInstance = ObjectRegistry::getRegistry('generic')->getInstance('auth');
                $authInstance->updateAuthData();
 
                // Write all updates to the database
index ab07e8c04fd17b85b0d0de65ea59dcb007ae3678..01b631d61eba5bdbd962f6437d6eb263b4d6d5dd 100644 (file)
@@ -151,7 +151,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                $userInstance = NULL;
 
                // Get a registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Is the user already there?
                if ($registryInstance->instanceExists('user')) {
index 10bb7f4885f519086bd1945814e646d1189d848e..27be04c17144232aa07a3ed5bf7614b474ed6caf 100644 (file)
@@ -117,7 +117,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable {
                $userInstance = NULL;
 
                // Get a registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Is the user already there?
                if ($registryInstance->instanceExists('user')) {
index d06c8211de0ec7f3d840f73f25ded840decf254d..6369652fcb2dfbd37b0ac37d767e0effd11e9f3d 100644 (file)
@@ -103,7 +103,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable {
                }
 
                // Get a user instance
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Get current hash
                $currentHash = $userInstance->getField('pass_hash');
index 785665fe3550b52a50305b9cfdbad394376dd67a..2c4316a73ebbf8697b1375a012072251847695b2 100644 (file)
@@ -91,7 +91,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable {
                }
 
                // Get a user instance from registry
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Get the confirm code from user for comparison
                $userCode = $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH);
index 21fcd2179ae3ccf3a291e0ace60707a1e62b7b54..e1f087d59a95675bd03169a771d7a3d2d24dcf14 100644 (file)
@@ -119,7 +119,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable {
                $userInstance = NULL;
 
                // Get a registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Is the user already there?
                if ($registryInstance->instanceExists('user')) {
index 49562ac48fccaef01e99e45c694b72c39a3ea622..cdd08a1a8ba1712f2d7aaf7a369db5133f00eaa8 100644 (file)
@@ -117,7 +117,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable {
                $userInstance = NULL;
 
                // Get a registry instance
-               $registryInstance = ObjectRegistry::getRegistry();
+               $registryInstance = ObjectRegistry::getRegistry('generic');
 
                // Is the user already there?
                if ($registryInstance->instanceExists('user')) {
index 44f53244539d1c10ea90c42fc0ba5ac2339c64b4..b025f5d04de99be2a2fa9efdcf4e8f1c49a9e59c 100644 (file)
@@ -65,7 +65,7 @@ class UserStatusVerifierFilter extends BaseFilter implements Filterable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get a user instance for comparison
-               $userInstance = ObjectRegistry::getRegistry()->getInstance('user');
+               $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
 
                // Is the user account confirmed?
                if ((!$userInstance->isConfirmed()) && (!$userInstance->isGuest()) && ($requestInstance->getRequestElement('action') != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('action_status_problem'))) {
index 53330065336fb607cc96d8e9b572a8c026dfad4b..46ea0c1ff005dae44bda428bb122799e5a8c876f 100644 (file)
@@ -94,7 +94,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable {
                }
 
                // Add this instance to registry
-               ObjectRegistry::getRegistry()->addInstance('user', $userInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('user', $userInstance);
        }
 
 }
index 4dfac8f3d5d8f007754b11f1fda0e5bb94212bb8..5c6ab7520d910245e58098f4d34cdec48dde0050 100644 (file)
@@ -263,7 +263,7 @@ abstract class BaseHelper extends BaseFrameworkSystem {
 
                try {
                        // Get the required instance
-                       $this->valueInstance = ObjectRegistry::getRegistry()->getInstance($registryKey);
+                       $this->valueInstance = ObjectRegistry::getRegistry('generic')->getInstance($registryKey);
                } catch (NullPointerException $e) {
                        // Not set in registry
                        //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HELPER: registryKey=%s returned no instance (NPE thrown)', $registryKey));
@@ -274,7 +274,7 @@ abstract class BaseHelper extends BaseFrameworkSystem {
                if (!is_null($extraKey)) {
                        try {
                                // Get the extra instance.
-                               $this->extraInstance = ObjectRegistry::getRegistry()->getInstance($extraKey);
+                               $this->extraInstance = ObjectRegistry::getRegistry('generic')->getInstance($extraKey);
                        } catch (NullPointerException $e) {
                                // Try to create it
                                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HELPER: extraKey=%s returned no instance (NPE thrown), this->valueInstance[]=%s', $extraKey, gettype($this->valueInstance)));
index 5db5e0414bdf48a62e0c3c47d9675964e30e90db..967ad93fcfd882feffe46811a82cd9a2e3802d35 100644 (file)
@@ -693,7 +693,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
 
                try {
                        // Get last executed pre filter
-                       $extraInstance = ObjectRegistry::getRegistry()->getInstance('extra');
+                       $extraInstance = ObjectRegistry::getRegistry('generic')->getInstance('extra');
                } catch (NullPointerException $e) {
                        // Instance in registry is not set (NULL)
                        // @TODO We need to log this later
index 3bb75f740e3fb4d3ee75934060020797fa95c8af..a4ffbcbceda27072f255889a086b5e82b44e5f63 100644 (file)
@@ -32,7 +32,7 @@ class ???Registry extends BaseRegistry implements Register {
        /**
         * Instance of this class
         */
-       private static $registryInstance = null;
+       private static $registryInstances = [];
 
        /**
         * Protected constructor
@@ -50,15 +50,15 @@ class ???Registry extends BaseRegistry implements Register {
         *
         * @return      $registryInstance       Instance of this class
         */
-       public final static function getRegistry () {
+       public final static function getRegistry (string $key) {
                // Is an instance there?
-               if (is_null(self::$registryInstance)) {
+               if (is_null(self::$registryInstances[$key])) {
                        // Not yet, so create one
-                       self::$registryInstance = new ???Registry();
+                       self::$registryInstances[$key] = new ???Registry();
                }
 
                // Return the instance
-               return self::$registryInstance;
+               return self::$registryInstances[$key];
        }
 
 }
index 21c944145a96769c8d1ac1bbf726ea0dcde7d788..5c2b3a010c5b87180c1ed3ffaac369923b869c5d 100644 (file)
@@ -45,17 +45,28 @@ class GenericRegistry extends BaseRegistry implements Register {
         * Singleton getter for self instance. This class has no factory pattern
         * because here is no need for special parameters.
         *
+        * @param       $key    Key for for this instance
         * @return      $registryInstance       Instance of this class
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static final function getRegistry () {
+       public static final function getRegistry (string $key) {
+               // Check parameter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key));
+               if (empty($key)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "key" is empty');
+               }
+
                // Is an instance there?
-               if (is_null(self::$registryInstance)) {
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s][]=%s', $key, gettype(self::$registryInstances[$key])));
+               if (is_null(self::$registryInstances[$key])) {
                        // Not yet, so create one
-                       self::$registryInstance = new GenericRegistry();
+                       self::$registryInstances[$key] = new ObjectRegistry();
                }
 
                // Return the instance
-               return self::$registryInstance;
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]=%s - EXIT!', $key, self::$registryInstances[$key]->__toString()));
+               return self::$registryInstances[$key];
        }
 
 }
index a5b7aa9a4183b7d2dac246809c6ec0d4ba55b09e..b3c810c947b30352835f54219040f69ace45c230 100644 (file)
@@ -35,9 +35,9 @@ use \InvalidArgumentException;
  */
 class ObjectRegistry extends BaseRegistry implements ObjectRegister {
        /**
-        * Instance of this class
+        * Instances of this class
         */
-       private static $registryInstance = NULL;
+       private static $registryInstances = [];
 
        /**
         * Protected constructor
@@ -61,17 +61,28 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         * Singleton getter for self instance. This class has no factory pattern
         * because here is no need for special parameters.
         *
+        * @param       $key    Key for for this instance
         * @return      $registryInstance       Instance of this class
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static final function getRegistry () {
+       public static final function getRegistry (string $key) {
+               // Check parameter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key));
+               if (empty($key)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "key" is empty');
+               }
+
                // Is an instance there?
-               if (is_null(self::$registryInstance)) {
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s][]=%s', $key, gettype(self::$registryInstances[$key])));
+               if (is_null(self::$registryInstances[$key])) {
                        // Not yet, so create one
-                       self::$registryInstance = new ObjectRegistry();
+                       self::$registryInstances[$key] = new ObjectRegistry();
                }
 
                // Return the instance
-               return self::$registryInstance;
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: self::registryInstance[%s]=%s - EXIT!', $key, self::$registryInstances[$key]->__toString()));
+               return self::$registryInstances[$key];
        }
 
        /**
index d8fc1a1cdbdabfac9ae6c2877420b1c869ccbf94..c4072c88d6fc781dc6e6d33c0db3d76f2a9a8c46 100644 (file)
@@ -74,7 +74,7 @@ class TestsConsoleMainCommand extends BaseCommand implements Commandable {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Starting tests ... ---');
 
                // Get controller
-               $controllerInstance = ObjectRegistry::getRegistry()->getInstance('controller');
+               $controllerInstance = ObjectRegistry::getRegistry('generic')->getInstance('controller');
 
                // Run all tests
                $controllerInstance->executeTestsFilters($requestInstance, $responseInstance);