From 92f69947ebf2dcdb696ae229a7a15bcc7b5910cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 25 Feb 2023 09:49:01 +0100 Subject: [PATCH] Continued: - introduced ObjectRegister (interface) and ObjectRegistry (class) for instance-registry related stuff --- .../bootstrap/class_FrameworkBootstrap.php | 1 - .../classes/class_BaseFrameworkSystem.php | 6 +- .../classes/commands/class_BaseCommand.php | 1 - .../html/class_HtmlConfirmCommand.php | 4 +- .../commands/html/class_HtmlHomeCommand.php | 1 - .../html/class_HtmlLoginAreaCommand.php | 6 +- .../commands/html/class_HtmlLoginCommand.php | 4 +- .../html/class_HtmlLoginFailedCommand.php | 1 - .../commands/html/class_HtmlLogoutCommand.php | 1 - .../html/class_HtmlLogoutDoneCommand.php | 1 - .../html/class_HtmlProblemCommand.php | 1 - .../html/class_HtmlRegisterCommand.php | 4 +- .../html/class_HtmlResendLinkCommand.php | 4 +- .../image/class_ImageCodeCaptchaCommand.php | 1 - .../controller/class_BaseController.php | 4 +- .../factories/client/class_ClientFactory.php | 6 +- .../class_DatabaseFrontendFactory.php | 4 +- .../index/class_FileStackIndexFactory.php | 8 +- .../factories/login/class_LoginFactory.php | 4 +- .../registry/class_SocketRegistryFactory.php | 4 +- .../stacks/class_FileStackFactory.php | 8 +- .../factories/user/class_UserFactory.php | 4 +- .../xml/class_XmlTemplateEngineFactory.php | 8 +- .../filter/auth/class_UserAuthFilter.php | 8 +- .../filter/change/class_EmailChangeFilter.php | 4 +- .../change/class_PasswordChangeFilter.php | 4 +- .../filter/news/class_NewsDownloadFilter.php | 4 +- .../payment/class_PaymentDiscoveryFilter.php | 4 +- .../class_UserStatusConfimedUpdateFilter.php | 4 +- .../filter/update/class_UserUpdateFilter.php | 6 +- .../validator/class_EmailValidatorFilter.php | 4 +- .../class_UserNameValidatorFilter.php | 4 +- .../class_AccountPasswordVerifierFilter.php | 4 +- .../class_ConfirmCodeVerifierFilter.php | 4 +- .../class_UserGuestVerifierFilter.php | 4 +- .../verifier/class_UserNameVerifierFilter.php | 4 +- .../class_UserStatusVerifierFilter.php | 4 +- .../class_UserUnconfirmedVerifierFilter.php | 4 +- .../main/classes/helper/class_BaseHelper.php | 6 +- .../html/forms/class_HtmlFormHelper.php | 4 +- .../html/links/class_HtmlLinkHelper.php | 1 - .../classes/language/class_LanguageSystem.php | 1 - .../main/classes/menu/class_BaseMenu.php | 1 - .../classes/registry/class_BaseRegistry.php | 91 ---------- .../registry/object/class_ObjectRegistry.php | 166 ++++++++++++++++++ .../class_BaseControllerResolver.php | 1 - .../classes/response/class_BaseResponse.php | 1 - .../response/html/class_HtmlResponse.php | 1 - .../response/image/class_ImageResponse.php | 1 - .../template/class_BaseTemplateEngine.php | 1 - .../console/class_ConsoleTemplateEngine.php | 1 - .../html/class_HtmlTemplateEngine.php | 1 - .../image/class_ImageTemplateEngine.php | 1 - .../mail/class_MailTemplateEngine.php | 1 - .../menu/class_MenuTemplateEngine.php | 1 - .../xml/class_BaseXmlTemplateEngine.php | 1 - .../interfaces/registry/class_Register.php | 32 ---- .../registry/object/class_ObjectRegister.php | 65 +++++++ .../console/class_TestsConsoleMainCommand.php | 4 +- 59 files changed, 310 insertions(+), 224 deletions(-) create mode 100644 framework/main/classes/registry/object/class_ObjectRegistry.php create mode 100644 framework/main/interfaces/registry/object/class_ObjectRegister.php diff --git a/framework/bootstrap/class_FrameworkBootstrap.php b/framework/bootstrap/class_FrameworkBootstrap.php index 65b017a9..f58a492d 100644 --- a/framework/bootstrap/class_FrameworkBootstrap.php +++ b/framework/bootstrap/class_FrameworkBootstrap.php @@ -17,7 +17,6 @@ use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index ca6a7f09..79380a23 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -15,7 +15,7 @@ use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Result\Database\CachedDatabaseResult; use Org\Mxchange\CoreFramework\State\Stateable; use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer; @@ -417,7 +417,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @return void */ public final function setWebOutputInstance (OutputStreamer $webInstance) { - GenericRegistry::getRegistry()->addInstance('web_output', $webInstance); + ObjectRegistry::getRegistry()->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 GenericRegistry::getRegistry()->getInstance('web_output'); + return ObjectRegistry::getRegistry()->getInstance('web_output'); } /** diff --git a/framework/main/classes/commands/class_BaseCommand.php b/framework/main/classes/commands/class_BaseCommand.php index 9ccf50cc..b31b1cb8 100644 --- a/framework/main/classes/commands/class_BaseCommand.php +++ b/framework/main/classes/commands/class_BaseCommand.php @@ -8,7 +8,6 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait; diff --git a/framework/main/classes/commands/html/class_HtmlConfirmCommand.php b/framework/main/classes/commands/html/class_HtmlConfirmCommand.php index 423ba69d..93eee3bb 100644 --- a/framework/main/classes/commands/html/class_HtmlConfirmCommand.php +++ b/framework/main/classes/commands/html/class_HtmlConfirmCommand.php @@ -11,7 +11,7 @@ use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Generic\NullPointerException; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -114,7 +114,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable { // Get user instance try { - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); } catch (NullPointerException $e) { // Not found user, e.g. when the user is somehow invalid $responseInstance->redirectToConfiguredUrl('html_cmd_user_is_null'); diff --git a/framework/main/classes/commands/html/class_HtmlHomeCommand.php b/framework/main/classes/commands/html/class_HtmlHomeCommand.php index 6ff23f1f..e532c2d2 100644 --- a/framework/main/classes/commands/html/class_HtmlHomeCommand.php +++ b/framework/main/classes/commands/html/class_HtmlHomeCommand.php @@ -9,7 +9,6 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php b/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php index 48b0df60..0b122fe2 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php @@ -10,7 +10,7 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -92,7 +92,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the action instance from registry - $actionInstance = GenericRegistry::getRegistry()->getInstance('action'); + $actionInstance = ObjectRegistry::getRegistry()->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 - GenericRegistry::getRegistry()->addInstance('action', $actionInstance); + ObjectRegistry::getRegistry()->addInstance('action', $actionInstance); } } diff --git a/framework/main/classes/commands/html/class_HtmlLoginCommand.php b/framework/main/classes/commands/html/class_HtmlLoginCommand.php index 3227d934..2c652736 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginCommand.php @@ -9,7 +9,7 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -73,7 +73,7 @@ class HtmlLoginCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Set request instance as extra instance - GenericRegistry::getRegistry()->addInstance('extra', $this); + ObjectRegistry::getRegistry()->addInstance('extra', $this); // Get the application instance $applicationInstance = ApplicationHelper::getSelfInstance(); diff --git a/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php b/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php index fd9c770c..e64f6ec0 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php @@ -9,7 +9,6 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlLogoutCommand.php b/framework/main/classes/commands/html/class_HtmlLogoutCommand.php index fb3ebdf6..9951a262 100644 --- a/framework/main/classes/commands/html/class_HtmlLogoutCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLogoutCommand.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php b/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php index 6669e6be..b70a9d4c 100644 --- a/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php @@ -9,7 +9,6 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlProblemCommand.php b/framework/main/classes/commands/html/class_HtmlProblemCommand.php index 1b876f7b..c6f35a72 100644 --- a/framework/main/classes/commands/html/class_HtmlProblemCommand.php +++ b/framework/main/classes/commands/html/class_HtmlProblemCommand.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlRegisterCommand.php b/framework/main/classes/commands/html/class_HtmlRegisterCommand.php index 8e0669af..a805930c 100644 --- a/framework/main/classes/commands/html/class_HtmlRegisterCommand.php +++ b/framework/main/classes/commands/html/class_HtmlRegisterCommand.php @@ -9,7 +9,7 @@ use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -73,7 +73,7 @@ class HtmlRegisterCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Set request instance as extra instance - GenericRegistry::getRegistry()->addInstance('extra', $this); + ObjectRegistry::getRegistry()->addInstance('extra', $this); // Get the application instance $applicationInstance = ApplicationHelper::getSelfInstance(); diff --git a/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php b/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php index 1506ebe7..dd0b683e 100644 --- a/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php +++ b/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php @@ -10,7 +10,7 @@ use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -74,7 +74,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get user instance from registry - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Get an application instance $applicationInstance = ApplicationHelper::getSelfInstance(); diff --git a/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php b/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php index 15f07d75..0491a952 100644 --- a/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php +++ b/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; diff --git a/framework/main/classes/controller/class_BaseController.php b/framework/main/classes/controller/class_BaseController.php index 0097720b..8067fcba 100644 --- a/framework/main/classes/controller/class_BaseController.php +++ b/framework/main/classes/controller/class_BaseController.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Chain\Filter\InvalidFilterChainException; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -68,7 +68,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl $this->initFilterChain(self::FILTER_CHAIN_POST_COMMAND); // Add this controller to the registry - GenericRegistry::getRegistry()->addInstance('controller', $this); + ObjectRegistry::getRegistry()->addInstance('controller', $this); } /** diff --git a/framework/main/classes/factories/client/class_ClientFactory.php b/framework/main/classes/factories/client/class_ClientFactory.php index 339f076d..19248724 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 (GenericRegistry::getRegistry()->instanceExists($registryKey)) { + if (ObjectRegistry::getRegistry()->instanceExists($registryKey)) { // Then use that instance - $clientInstance = GenericRegistry::getRegistry()->getInstance($registryKey); + $clientInstance = ObjectRegistry::getRegistry()->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 - GenericRegistry::getRegistry()->addInstance($registryKey, $clientInstance); + ObjectRegistry::getRegistry()->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 741637cc..90ea3e2e 100644 --- a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php +++ b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php @@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Database\Frontend; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; /** * A factory class for socket registries @@ -49,7 +49,7 @@ class DatabaseFrontendFactory extends BaseFactory { */ public static final function createFrontendByConfiguredName (string $frontendName) { // Get registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // 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 b72188c4..ad29daa3 100644 --- a/framework/main/classes/factories/index/class_FileStackIndexFactory.php +++ b/framework/main/classes/factories/index/class_FileStackIndexFactory.php @@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Stack\File; use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; // Import SPL stuff use \InvalidArgumentException; @@ -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 (GenericRegistry::getRegistry()->instanceExists($type . '_index')) { + } elseif (ObjectRegistry::getRegistry()->instanceExists($type . '_index')) { // Get handler from registry - $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index'); + $indexInstance = ObjectRegistry::getRegistry()->getInstance($type . '_index'); } else { // Get the handler instance $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', [$fileInfoInstance]); // Add it to the registry - GenericRegistry::getRegistry()->addInstance($type . '_index', $indexInstance); + ObjectRegistry::getRegistry()->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 cd7265de..f668e726 100644 --- a/framework/main/classes/factories/login/class_LoginFactory.php +++ b/framework/main/classes/factories/login/class_LoginFactory.php @@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Login; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; /** @@ -49,7 +49,7 @@ class LoginFactory extends BaseFactory { */ public static final function createLoginObjectByRequest (Requestable $requestInstance) { // Get registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // 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 62d74235..13cc619a 100644 --- a/framework/main/classes/factories/registry/class_SocketRegistryFactory.php +++ b/framework/main/classes/factories/registry/class_SocketRegistryFactory.php @@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Registry\Socket; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; /** * A factory class for socket registries @@ -49,7 +49,7 @@ class SocketRegistryFactory extends BaseFactory { */ public static final function createSocketRegistryInstance () { // Get registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // 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 e40cc571..9691a6ed 100644 --- a/framework/main/classes/factories/stacks/class_FileStackFactory.php +++ b/framework/main/classes/factories/stacks/class_FileStackFactory.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; // Import SPL stuff use \InvalidArgumentException; @@ -73,15 +73,15 @@ class FileStackFactory extends BaseFactory { )); // If there is no handler? - if (GenericRegistry::getRegistry()->instanceExists($stackName . '_stack')) { + if (ObjectRegistry::getRegistry()->instanceExists($stackName . '_stack')) { // Get handler from registry - $stackInstance = GenericRegistry::getRegistry()->getInstance($stackName . '_stack'); + $stackInstance = ObjectRegistry::getRegistry()->getInstance($stackName . '_stack'); } else { // Get the handler instance $stackInstance = ObjectFactory::createObjectByConfiguredName($prefix . '_' . $stackName . '_stack_class', array($fileInfoInstance, $prefix . '_' . $stackName)); // Add it to the registry - GenericRegistry::getRegistry()->addInstance($stackName . '_stack', $stackInstance); + ObjectRegistry::getRegistry()->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 e041351e..45821525 100644 --- a/framework/main/classes/factories/user/class_UserFactory.php +++ b/framework/main/classes/factories/user/class_UserFactory.php @@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Factory\User; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\BaseFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; /** @@ -49,7 +49,7 @@ class UserFactory extends BaseFactory { */ public static final function createUserByRequest (Requestable $requestInstance) { // Get registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // 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 24ff87fb..f6b5bda6 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Template; use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; // Import SPL stuff use \InvalidArgumentException; @@ -63,9 +63,9 @@ class XmlTemplateEngineFactory extends BaseFactory { } // Do we have an instance in the registry? - if (GenericRegistry::getRegistry()->instanceExists($configKey)) { + if (ObjectRegistry::getRegistry()->instanceExists($configKey)) { // Then use this instance - $templateInstance = GenericRegistry::getRegistry()->getInstance($configKey); + $templateInstance = ObjectRegistry::getRegistry()->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 - GenericRegistry::getRegistry()->addInstance($configKey, $templateInstance); + ObjectRegistry::getRegistry()->addInstance($configKey, $templateInstance); } // Return the instance diff --git a/framework/main/classes/filter/auth/class_UserAuthFilter.php b/framework/main/classes/filter/auth/class_UserAuthFilter.php index 11422845..d909bd21 100644 --- a/framework/main/classes/filter/auth/class_UserAuthFilter.php +++ b/framework/main/classes/filter/auth/class_UserAuthFilter.php @@ -9,7 +9,7 @@ use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Loader\NoClassException; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\User\BaseUser; @@ -131,7 +131,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { } // Now try the dynamic login - $userInstance = call_user_func_array(array($className, $methodName), array($authLogin)); + $userInstance = call_user_func_array([$className, $methodName], [$authLogin]); // Is the password correct? if ($userInstance->getPasswordHash() !== $authHash) { @@ -140,8 +140,8 @@ class UserAuthFilter extends BaseFilter implements Filterable { } // Remember auth and user instances in registry - GenericRegistry::getRegistry()->addInstance('auth', $authInstance); - GenericRegistry::getRegistry()->addInstance('user', $userInstance); + ObjectRegistry::getRegistry()->addInstance('auth', $authInstance); + ObjectRegistry::getRegistry()->addInstance('user', $userInstance); } } diff --git a/framework/main/classes/filter/change/class_EmailChangeFilter.php b/framework/main/classes/filter/change/class_EmailChangeFilter.php index a8411e70..25e4729d 100644 --- a/framework/main/classes/filter/change/class_EmailChangeFilter.php +++ b/framework/main/classes/filter/change/class_EmailChangeFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -114,7 +114,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { } // Now, get a user instance for comparison - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Get the email field $userEmail = $userInstance->getField('email'); diff --git a/framework/main/classes/filter/change/class_PasswordChangeFilter.php b/framework/main/classes/filter/change/class_PasswordChangeFilter.php index 7eaaa2ee..8a011d07 100644 --- a/framework/main/classes/filter/change/class_PasswordChangeFilter.php +++ b/framework/main/classes/filter/change/class_PasswordChangeFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -115,7 +115,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { } // Now, get a user instance for comparison - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Update the "password" field DebugMiddleware::getSelfInstance()->partialStub('Unfinished part.'); diff --git a/framework/main/classes/filter/news/class_NewsDownloadFilter.php b/framework/main/classes/filter/news/class_NewsDownloadFilter.php index c5e12513..c4323697 100644 --- a/framework/main/classes/filter/news/class_NewsDownloadFilter.php +++ b/framework/main/classes/filter/news/class_NewsDownloadFilter.php @@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filter\News; use Org\Mxchange\CoreFramework\Factory\News\HtmlNewsFactory; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -70,7 +70,7 @@ class NewsDownloadFilter extends BaseFilter implements Filterable { $newsInstance = HtmlNewsFactory::createFactoryByRequest($requestInstance); // Store the news instance in registry - GenericRegistry::getRegistry()->addInstance('news', $newsInstance); + ObjectRegistry::getRegistry()->addInstance('news', $newsInstance); } } diff --git a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php index 14046dc8..c89e7d31 100644 --- a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php +++ b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php @@ -11,7 +11,7 @@ use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Loader\NoClassException; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -123,7 +123,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { $discoveryInstance->discover($requestInstance); // Remember this instance if all wents fine - GenericRegistry::getRegistry()->addInstance('payments', $discoveryInstance); + ObjectRegistry::getRegistry()->addInstance('payments', $discoveryInstance); } catch (NoConfigEntryException $e) { // Something bad happend $requestInstance->setIsRequestValid(FALSE); diff --git a/framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php b/framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php index c9719eb6..5d2f1e35 100644 --- a/framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php +++ b/framework/main/classes/filter/update/class_UserStatusConfimedUpdateFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -66,7 +66,7 @@ class UserStatusConfimedUpdateFilter extends BaseFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get user instance from registry - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Get "confirmed" status from config $confirmed = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_confirmed'); diff --git a/framework/main/classes/filter/update/class_UserUpdateFilter.php b/framework/main/classes/filter/update/class_UserUpdateFilter.php index 737d6511..cf932497 100644 --- a/framework/main/classes/filter/update/class_UserUpdateFilter.php +++ b/framework/main/classes/filter/update/class_UserUpdateFilter.php @@ -5,7 +5,7 @@ namespace Org\Mxchange\CoreFramework\Filter\User; // Import framework stuff use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -66,13 +66,13 @@ class UserUpdateFilter extends BaseFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get user instance from registry - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Now update last activity $userInstance->updateLastActivity($requestInstance); // Update auth data as well - $authInstance = GenericRegistry::getRegistry()->getInstance('auth'); + $authInstance = ObjectRegistry::getRegistry()->getInstance('auth'); $authInstance->updateAuthData(); // Write all updates to the database diff --git a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php index f26d9e1e..ab07e8c0 100644 --- a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -151,7 +151,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { $userInstance = NULL; // Get a registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // Is the user already there? if ($registryInstance->instanceExists('user')) { diff --git a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php index 4a97638f..10bb7f48 100644 --- a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\User\UsernameMissingException; @@ -117,7 +117,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { $userInstance = NULL; // Get a registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // Is the user already there? if ($registryInstance->instanceExists('user')) { diff --git a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php index f5e10565..d06c8211 100644 --- a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\User\BaseUser; @@ -103,7 +103,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { } // Get a user instance - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Get current hash $currentHash = $userInstance->getField('pass_hash'); diff --git a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php index a83e66ab..785665fe 100644 --- a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -91,7 +91,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { } // Get a user instance from registry - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Get the confirm code from user for comparison $userCode = $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH); diff --git a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php index a027a3a1..21fcd217 100644 --- a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -119,7 +119,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { $userInstance = NULL; // Get a registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // Is the user already there? if ($registryInstance->instanceExists('user')) { diff --git a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php index 2c19be2e..49562ac4 100644 --- a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\User\UsernameMissingException; @@ -117,7 +117,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { $userInstance = NULL; // Get a registry instance - $registryInstance = GenericRegistry::getRegistry(); + $registryInstance = ObjectRegistry::getRegistry(); // Is the user already there? if ($registryInstance->instanceExists('user')) { diff --git a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php index 2d16e7d3..44f53244 100644 --- a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php @@ -6,7 +6,7 @@ namespace Org\Mxchange\CoreFramework\Filter\Verifier\User; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -65,7 +65,7 @@ class UserStatusVerifierFilter extends BaseFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a user instance for comparison - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + $userInstance = ObjectRegistry::getRegistry()->getInstance('user'); // Is the user account confirmed? if ((!$userInstance->isConfirmed()) && (!$userInstance->isGuest()) && ($requestInstance->getRequestElement('action') != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('action_status_problem'))) { diff --git a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php index 3890515a..53330065 100644 --- a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php @@ -8,7 +8,7 @@ use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\User\UserFactory; use Org\Mxchange\CoreFramework\Filter\BaseFilter; use Org\Mxchange\CoreFramework\Filter\Filterable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -94,7 +94,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { } // Add this instance to registry - GenericRegistry::getRegistry()->addInstance('user', $userInstance); + ObjectRegistry::getRegistry()->addInstance('user', $userInstance); } } diff --git a/framework/main/classes/helper/class_BaseHelper.php b/framework/main/classes/helper/class_BaseHelper.php index ef87c282..4dfac8f3 100644 --- a/framework/main/classes/helper/class_BaseHelper.php +++ b/framework/main/classes/helper/class_BaseHelper.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; // Import SPL stuff @@ -263,7 +263,7 @@ abstract class BaseHelper extends BaseFrameworkSystem { try { // Get the required instance - $this->valueInstance = GenericRegistry::getRegistry()->getInstance($registryKey); + $this->valueInstance = ObjectRegistry::getRegistry()->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 = GenericRegistry::getRegistry()->getInstance($extraKey); + $this->extraInstance = ObjectRegistry::getRegistry()->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))); diff --git a/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php b/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php index 8ec93a69..5db5e041 100644 --- a/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php +++ b/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php @@ -8,7 +8,7 @@ use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; // Import SPL stuff @@ -693,7 +693,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { try { // Get last executed pre filter - $extraInstance = GenericRegistry::getRegistry()->getInstance('extra'); + $extraInstance = ObjectRegistry::getRegistry()->getInstance('extra'); } catch (NullPointerException $e) { // Instance in registry is not set (NULL) // @TODO We need to log this later diff --git a/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php b/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php index c87cd0c6..f4b0ffe6 100644 --- a/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php +++ b/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php @@ -9,7 +9,6 @@ use Org\Mxchange\CoreFramework\Configuration\NoConfigEntryException; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; diff --git a/framework/main/classes/language/class_LanguageSystem.php b/framework/main/classes/language/class_LanguageSystem.php index 67f08480..44e8801f 100644 --- a/framework/main/classes/language/class_LanguageSystem.php +++ b/framework/main/classes/language/class_LanguageSystem.php @@ -10,7 +10,6 @@ use Org\Mxchange\CoreFramework\Localization\ManageableLanguage; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\ObjectArray\FrameworkArrayObject; use Org\Mxchange\CoreFramework\Registry\Registerable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff use \InvalidArgumentException; diff --git a/framework/main/classes/menu/class_BaseMenu.php b/framework/main/classes/menu/class_BaseMenu.php index 8494e472..72ed27cf 100644 --- a/framework/main/classes/menu/class_BaseMenu.php +++ b/framework/main/classes/menu/class_BaseMenu.php @@ -8,7 +8,6 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait; diff --git a/framework/main/classes/registry/class_BaseRegistry.php b/framework/main/classes/registry/class_BaseRegistry.php index a309efda..f877026b 100644 --- a/framework/main/classes/registry/class_BaseRegistry.php +++ b/framework/main/classes/registry/class_BaseRegistry.php @@ -5,7 +5,6 @@ namespace Org\Mxchange\CoreFramework\Registry; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; -use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait; @@ -58,7 +57,6 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg // Init generic arrays $this->initGenericArrayGroup('registry', 'generic'); - $this->initGenericArrayGroup('registry', 'instance'); // Trace message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-REGISTRY: EXIT!'); @@ -94,54 +92,6 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg return $iteratorInstance; } - /** - * Checks whether an instance key was found - * - * @param $instanceKey The key holding an instance in registry - * @return $exists Whether the key exists in registry - * @throws InvalidArgumentException If a paramter has an invalid value - */ - public function instanceExists (string $instanceKey) { - // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); - if (empty($instanceKey)) { - // Throw IAE - throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } - - // Does this key exists? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: Invoking this->isGenericArrayKeySet(registry, instance, %s) ...', $instanceKey)); - $exists = $this->isGenericArrayKeySet('registry', 'instance', $instanceKey); - - // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: exists=%d - EXIT!', intval($exists))); - return $exists; - } - - /** - * Adds/overwrites a new instance to the registry at the given key - * - * @param $instanceKey The key to identify the instance - * @param $objectInstance An instance we shall store - * @return void - * @throws InvalidArgumentException If a paramter has an invalid value - */ - public function addInstance (string $instanceKey, Registerable $objectInstance) { - // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: instanceKey=%s,objectInstance=%s - CALLED!', $instanceKey, $objectInstance->__toString())); - if (empty($instanceKey)) { - // Throw IAE - throw new InvalidArgumentExeption('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } - - // Set entry in generic array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: Invoking this->setGenericArrayKey(registry,instance,%s,%s) ...', $instanceKey, $objectInstance->__toString())); - $this->setGenericArrayKey('registry', 'instance', $instanceKey, $objectInstance); - - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-REGISTRY: EXIT!'); - } - /** * Getter for whole generic registry * @@ -151,15 +101,6 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg return $this->getGenericSubArray('registry', 'generic'); } - /** - * Getter for whole instance registry - * - * @return $instanceRegistry The whole instance registry array - */ - public final function getInstanceRegistry () { - return $this->getGenericSubArray('registry', 'instance'); - } - /** * Adds a new entry to the given list name. If you want to add objects * please use addInstance() and getInstance() instead. @@ -282,38 +223,6 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg return $entry; } - /** - * Gets a registered instance or null if not found - * - * @param $instanceKey The key to identify the instance - * @return $objectInstance An instance we shall store - * @throws InvalidArgumentException If a paramter has an invalid value - * @throws NullPointerException If the requested key is not found - */ - public function getInstance (string $instanceKey) { - // Check parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); - if (empty($instanceKey)) { - // Throw IAE - throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } - - // Is the instance there? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: Invoking this->instanceExists(%s) ...', $instanceKey)); - if (!$this->instanceExists($instanceKey)) { - // This might happen if a non-registered key was requested - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } - - // Get the instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: Invoking this->getGenericArrayKey(registry,instance,%s) ...', $instanceKey)); - $objectInstance = $this->getGenericArrayKey('registry', 'instance', $instanceKey); - - // Return the result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: objectInstance=%s - EXIT!', $objectInstance->__toString())); - return $objectInstance; - } - /** * "Getter" for a registry key for given prefix and array. This method * calls implode() to get a suitable key. This method does not care about diff --git a/framework/main/classes/registry/object/class_ObjectRegistry.php b/framework/main/classes/registry/object/class_ObjectRegistry.php new file mode 100644 index 00000000..a5b7aa9a --- /dev/null +++ b/framework/main/classes/registry/object/class_ObjectRegistry.php @@ -0,0 +1,166 @@ + + * @version 0.0.0 + * @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 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ObjectRegistry extends BaseRegistry implements ObjectRegister { + /** + * Instance of this class + */ + private static $registryInstance = NULL; + + /** + * Protected constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: CONSTRUCTED!'); + parent::__construct(__CLASS__); + + // Init own array + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: Invoking this->initGenericArrayGroup(registry,instance) ...'); + $this->initGenericArrayGroup('registry', 'instance'); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); + } + + /** + * Singleton getter for self instance. This class has no factory pattern + * because here is no need for special parameters. + * + * @return $registryInstance Instance of this class + */ + public static final function getRegistry () { + // Is an instance there? + if (is_null(self::$registryInstance)) { + // Not yet, so create one + self::$registryInstance = new ObjectRegistry(); + } + + // Return the instance + return self::$registryInstance; + } + + /** + * Checks whether an instance key was found + * + * @param $instanceKey The key holding an instance in registry + * @return $exists Whether the key exists in registry + * @throws InvalidArgumentException If a paramter has an invalid value + */ + public function instanceExists (string $instanceKey) { + // Check parameter + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); + if (empty($instanceKey)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + + // Does this key exists? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->isGenericArrayKeySet(registry, instance, %s) ...', $instanceKey)); + $exists = $this->isGenericArrayKeySet('registry', 'instance', $instanceKey); + + // Return the result + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: exists=%d - EXIT!', intval($exists))); + return $exists; + } + + /** + * Getter for whole instance registry + * + * @return $instanceRegistry The whole instance registry array + */ + public final function getInstanceRegistry () { + return $this->getGenericSubArray('registry', 'instance'); + } + + /** + * Adds/overwrites a new instance to the registry at the given key + * + * @param $instanceKey The key to identify the instance + * @param $objectInstance An instance we shall store + * @return void + * @throws InvalidArgumentException If a paramter has an invalid value + */ + public function addInstance (string $instanceKey, Registerable $objectInstance) { + // Check parameter + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s,objectInstance=%s - CALLED!', $instanceKey, $objectInstance->__toString())); + if (empty($instanceKey)) { + // Throw IAE + throw new InvalidArgumentExeption('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + + // Set entry in generic array + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->setGenericArrayKey(registry,instance,%s,%s) ...', $instanceKey, $objectInstance->__toString())); + $this->setGenericArrayKey('registry', 'instance', $instanceKey, $objectInstance); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('OBJECT-REGISTRY: EXIT!'); + } + + /** + * Gets a registered instance or null if not found + * + * @param $instanceKey The key to identify the instance + * @return $objectInstance An instance we shall store + * @throws InvalidArgumentException If a paramter has an invalid value + * @throws NullPointerException If the requested key is not found + */ + public function getInstance (string $instanceKey) { + // Check parameter + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey)); + if (empty($instanceKey)) { + // Throw IAE + throw new InvalidArgumentException('Parameter "instanceKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); + } + + // Is the instance there? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->instanceExists(%s) ...', $instanceKey)); + if (!$this->instanceExists($instanceKey)) { + // This might happen if a non-registered key was requested + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } + + // Get the instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: Invoking this->getGenericArrayKey(registry,instance,%s) ...', $instanceKey)); + $objectInstance = $this->getGenericArrayKey('registry', 'instance', $instanceKey); + + // Return the result + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: objectInstance=%s - EXIT!', $objectInstance->__toString())); + return $objectInstance; + } + +} diff --git a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php index bfea4f87..f60774d8 100644 --- a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php +++ b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php @@ -10,7 +10,6 @@ use Org\Mxchange\CoreFramework\Controller\InvalidControllerException; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Resolver\BaseResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; diff --git a/framework/main/classes/response/class_BaseResponse.php b/framework/main/classes/response/class_BaseResponse.php index 97dc1b0a..33f6efec 100644 --- a/framework/main/classes/response/class_BaseResponse.php +++ b/framework/main/classes/response/class_BaseResponse.php @@ -6,7 +6,6 @@ namespace Org\Mxchange\CoreFramework\Response; use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; /** * A generic request class diff --git a/framework/main/classes/response/html/class_HtmlResponse.php b/framework/main/classes/response/html/class_HtmlResponse.php index b81a30a9..5c5beed7 100644 --- a/framework/main/classes/response/html/class_HtmlResponse.php +++ b/framework/main/classes/response/html/class_HtmlResponse.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Response\Responseable; /** diff --git a/framework/main/classes/response/image/class_ImageResponse.php b/framework/main/classes/response/image/class_ImageResponse.php index aa25d792..783c8489 100644 --- a/framework/main/classes/response/image/class_ImageResponse.php +++ b/framework/main/classes/response/image/class_ImageResponse.php @@ -8,7 +8,6 @@ use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Image\BaseImage; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Response\Responseable; /** diff --git a/framework/main/classes/template/class_BaseTemplateEngine.php b/framework/main/classes/template/class_BaseTemplateEngine.php index 9e85c24f..3594bb7b 100644 --- a/framework/main/classes/template/class_BaseTemplateEngine.php +++ b/framework/main/classes/template/class_BaseTemplateEngine.php @@ -12,7 +12,6 @@ use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait; use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils; diff --git a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php index e15a33d8..438e5a39 100644 --- a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php +++ b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; diff --git a/framework/main/classes/template/html/class_HtmlTemplateEngine.php b/framework/main/classes/template/html/class_HtmlTemplateEngine.php index 4c5863ba..8894b9bb 100644 --- a/framework/main/classes/template/html/class_HtmlTemplateEngine.php +++ b/framework/main/classes/template/html/class_HtmlTemplateEngine.php @@ -7,7 +7,6 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; diff --git a/framework/main/classes/template/image/class_ImageTemplateEngine.php b/framework/main/classes/template/image/class_ImageTemplateEngine.php index 92591a98..31a011da 100644 --- a/framework/main/classes/template/image/class_ImageTemplateEngine.php +++ b/framework/main/classes/template/image/class_ImageTemplateEngine.php @@ -11,7 +11,6 @@ use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Image\BaseImage; use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; use Org\Mxchange\CoreFramework\Parser\Parseable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; diff --git a/framework/main/classes/template/mail/class_MailTemplateEngine.php b/framework/main/classes/template/mail/class_MailTemplateEngine.php index 1be38d42..a54f98d9 100644 --- a/framework/main/classes/template/mail/class_MailTemplateEngine.php +++ b/framework/main/classes/template/mail/class_MailTemplateEngine.php @@ -9,7 +9,6 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Mailer\DeliverableMail; use Org\Mxchange\CoreFramework\Parser\Parseable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Response\Responseable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; diff --git a/framework/main/classes/template/menu/class_MenuTemplateEngine.php b/framework/main/classes/template/menu/class_MenuTemplateEngine.php index dca4118c..e7e932a5 100644 --- a/framework/main/classes/template/menu/class_MenuTemplateEngine.php +++ b/framework/main/classes/template/menu/class_MenuTemplateEngine.php @@ -10,7 +10,6 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; use Org\Mxchange\CoreFramework\Menu\RenderableMenu; use Org\Mxchange\CoreFramework\Parser\Parseable; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Traits\Stack\StackableTrait; diff --git a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php index 60c7ee6c..2ce4f693 100644 --- a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php +++ b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php @@ -8,7 +8,6 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory; use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate; diff --git a/framework/main/interfaces/registry/class_Register.php b/framework/main/interfaces/registry/class_Register.php index 8e2daa03..bfda3c3b 100644 --- a/framework/main/interfaces/registry/class_Register.php +++ b/framework/main/interfaces/registry/class_Register.php @@ -28,22 +28,6 @@ use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; * along with this program. If not, see . */ interface Register extends FrameworkInterface { - /** - * Checks whether an instance key was found - * - * @param $instanceKey The key holding an instance in registry - * @return $exists Whether the key exists in registry - */ - function instanceExists (string $instanceKey); - - /** - * Adds/overwrites a new instance to the registry at the given key - * - * @param $instanceKey The key to identify the instance - * @param $objectInstance An instance we shall store - * @return void - */ - function addInstance (string $instanceKey, Registerable $objectInstance); /** * Getter for whole generic registry @@ -52,13 +36,6 @@ interface Register extends FrameworkInterface { */ function getGenericRegistry (); - /** - * Getter for whole instance registry - * - * @return $instanceRegistry The whole instance registry array - */ - function getInstanceRegistry (); - /** * Adds a new entry to the given list name. If you want to add objects * please use addInstance() and getInstance() instead. @@ -85,13 +62,4 @@ interface Register extends FrameworkInterface { */ function getArrayFromKey (string $arrayKey, string $lookFor); - /** - * Gets a registered instance or null if not found - * - * @param $instanceKey The key to identify the instance - * @return $objectInstance An instance we shall store - * @throws NullPointerException If the requested key is not found - */ - function getInstance (string $instanceKey); - } diff --git a/framework/main/interfaces/registry/object/class_ObjectRegister.php b/framework/main/interfaces/registry/object/class_ObjectRegister.php new file mode 100644 index 00000000..cdc9b8cb --- /dev/null +++ b/framework/main/interfaces/registry/object/class_ObjectRegister.php @@ -0,0 +1,65 @@ + + * @version 0.0.0 + * @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 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface ObjectRegister extends Register { + /** + * Checks whether an instance key was found + * + * @param $instanceKey The key holding an instance in registry + * @return $exists Whether the key exists in registry + */ + function instanceExists (string $instanceKey); + + /** + * Adds/overwrites a new instance to the registry at the given key + * + * @param $instanceKey The key to identify the instance + * @param $objectInstance An instance we shall store + * @return void + */ + function addInstance (string $instanceKey, Registerable $objectInstance); + + /** + * Getter for whole instance registry + * + * @return $instanceRegistry The whole instance registry array + */ + function getInstanceRegistry (); + + /** + * Gets a registered instance or null if not found + * + * @param $instanceKey The key to identify the instance + * @return $objectInstance An instance we shall store + * @throws NullPointerException If the requested key is not found + */ + function getInstance (string $instanceKey); + +} diff --git a/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php b/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php index 896acbf0..d8fc1a1c 100644 --- a/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php +++ b/framework/main/tests/commands/console/class_TestsConsoleMainCommand.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; -use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -74,7 +74,7 @@ class TestsConsoleMainCommand extends BaseCommand implements Commandable { self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: --- Starting tests ... ---'); // Get controller - $controllerInstance = GenericRegistry::getRegistry()->getInstance('controller'); + $controllerInstance = ObjectRegistry::getRegistry()->getInstance('controller'); // Run all tests $controllerInstance->executeTestsFilters($requestInstance, $responseInstance); -- 2.39.5