]> git.mxchange.org Git - city.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 11 Apr 2018 20:56:11 +0000 (22:56 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 11 Apr 2018 20:56:11 +0000 (22:56 +0200)
- need to initialize web output instance when request type is 'html'
- but only need to shutdown (and show messages) when 'console' is set
- assignApplicationData() does no longer accept $applicationInstance which
  makes sense as it can be obtained from GenericRegistry
- also removed same parameter from factory methods
- no need to invoke setApplicationInstance() for above same reason
  (this is called inter-mezzo pattern)
- updated core to latest commit id
- updated index.php from core

Signed-off-by: Roland Häder <roland@mxchange.org>
15 files changed:
application/city/class_ApplicationHelper.php
application/city/classes/commands/html/class_CityHtmlConfirmCommand.php
application/city/classes/commands/html/class_CityHtmlLoginAreaCommand.php
application/city/classes/commands/html/class_CityHtmlLoginCommand.php
application/city/classes/commands/html/class_CityHtmlLoginFailedCommand.php
application/city/classes/commands/html/class_CityHtmlResendLinkCommand.php
application/city/classes/commands/html/class_HtmlLogoutDoneCommand.php
application/city/classes/factories/city_daemon/class_CityDaemonFactory.php
application/city/classes/resolver/command/console/class_CityConsoleCommandResolver.php
application/city/classes/resolver/command/html/class_CityHtmlCommandResolver.php
application/city/classes/resolver/controller/console/class_CityConsoleControllerResolver.php
application/city/classes/resolver/controller/html/class_CityHtmlControllerResolver.php
application/city/classes/resolver/controller/image/class_CityImageControllerResolver.php
core
index.php

index 5aa8b14a4a821214a5761c26979a6afd27f82868..17bf18b79def945d127a7ccfdb9b44f445254ea0 100644 (file)
@@ -214,7 +214,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                                FrameworkBootstrap::getRequestTypeFromSystem()
                        ))
                );
-               $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
+               $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName));
 
                // Get a controller instance as well
                $this->setControllerInstance($resolverInstance->resolveController());
@@ -225,13 +225,22 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication
                // And set it here
                $this->setLanguageInstance($languageInstance);
 
-               // Launch the test suite here
+               // Is html request?
+               if (FrameworkBootstrap::getRequestTypeFromSystem() == 'html') {
+                       // Init web output instance
+                       $this->initWebOutputInstance();
+               }
+
+               // Launch the application here
                $this->getControllerInstance()->handleRequest($requestInstance, $responseInstance);
 
-               // -------------------------- Shutdown phase --------------------------
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown in progress ...');
-               $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
+               // Is console request?
+               if (FrameworkBootstrap::getRequestTypeFromSystem() == 'console') {
+                       // -------------------------- Shutdown phase --------------------------
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown in progress ...');
+                       $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
+               }
        }
 
        /**
index 81a6cabd0f80f7b262ec166f155f4cb8839afcf7..967e687a046bd1447b9ce24853457a7458265c08 100644 (file)
@@ -76,7 +76,7 @@ class CityHtmlConfirmCommand extends BaseCommand implements Commandable {
                $templateInstance = $this->prepareTemplateInstance($applicationInstance);
 
                // Assign application data with template engine
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Assign base URL
                $templateInstance->assignConfigVariable('base_url');
index 4197b4d39fac4eb8c224699679c43cc7cda76d4c..7344cb3feebec34bfac2c17c6dae766e7a3c4119 100644 (file)
@@ -103,7 +103,7 @@ class CityHtmlLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->assignConfigVariable('base_url');
 
                // Assign all the application's data with template variables
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Load the master template
                $masterTemplate = $applicationInstance->buildMasterTemplateName();
@@ -192,11 +192,8 @@ class CityHtmlLoginAreaCommand extends BaseCommand implements Commandable {
                        $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $actReq;
                } // END - if
 
-               // Get application instance
-               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
-
                // Get a resolver
-               $actionResolver = HtmlActionResolver::createHtmlActionResolver($this->actionName, $applicationInstance);
+               $actionResolver = HtmlActionResolver::createHtmlActionResolver($this->actionName);
 
                // Resolve the action
                $actionInstance = $actionResolver->resolveAction();
@@ -207,4 +204,5 @@ class CityHtmlLoginAreaCommand extends BaseCommand implements Commandable {
                // Remember this action in registry
                GenericRegistry::getRegistry()->addInstance('action', $actionInstance);
        }
+
 }
index 5ead86c7e79d81115cea317958047b45635ce376..69507599b433f2558557c2e8edef81e2435f4759 100644 (file)
@@ -79,7 +79,7 @@ class CityHtmlLoginCommand extends BaseCommand implements Commandable, Registera
                $templateInstance = $this->prepareTemplateInstance($applicationInstance);
 
                // Assign application data with template engine
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Assign base URL
                $templateInstance->assignConfigVariable('base_url');
index d1c24ad86b62d23cf8be2e11fd34b87861b79d5e..2ef1638f884447c83c4c88ddf6a68d1849ab1763 100644 (file)
@@ -75,7 +75,7 @@ class CityHtmlLoginFailedCommand extends BaseCommand implements Commandable {
                $templateInstance = $this->prepareTemplateInstance($applicationInstance);
 
                // Assign application data with template engine
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Load the master template
                $masterTemplate = $applicationInstance->buildMasterTemplateName();
index c625b14c35510748b474e1809eb077b9dd5acb35..b217ff506fa2efb0590601cb21d1e7c96956cee4 100644 (file)
@@ -98,10 +98,10 @@ class CityHtmlResendLinkCommand extends BaseCommand implements Commandable {
                $templateInstance = $this->prepareTemplateInstance($applicationInstance);
 
                // Assign the application data with the template engine
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Get a mailer class
-               $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, $applicationInstance, 'resend_link'));
+               $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, 'resend_link'));
 
                // Set this mailer in our template engine
                $templateInstance->setMailerInstance($mailerInstance);
index 90b3206523a82056ffaccb2c94f732e3a2bc2e5c..09c3e4b4142f630a821a084b0b659a4dd9db451c 100644 (file)
@@ -76,7 +76,7 @@ class HtmlLogoutDoneCommand extends BaseCommand implements Commandable {
                $templateInstance = $this->prepareTemplateInstance($applicationInstance);
 
                // Assign application data
-               $templateInstance->assignApplicationData($applicationInstance);
+               $templateInstance->assignApplicationData();
 
                // Load the master template
                $masterTemplate = $applicationInstance->buildMasterTemplateName();
index c4ada485fa2865668c8908d01574aa8734849929..bd84eace122816b47efe4f4c0f665ca5d3ff3d91 100644 (file)
@@ -79,9 +79,6 @@ class CityDaemonFactory extends ObjectFactory {
                        // Get a registry
                        $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
-                       // Set the app instance
-                       $cityInstance->setApplicationInstance($applicationInstance);
-
                        // Add city-specific filters
                        $cityInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
                } else {
@@ -92,4 +89,5 @@ class CityDaemonFactory extends ObjectFactory {
                // Return the instance
                return $cityInstance;
        }
+
 }
index 1e6fc9a303248b174cea891d2f83d1a019ed12fe..308955557af5f484cfd22e737dcaa2936f153b22 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\City\Resolver\Command;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Command\BaseCommandResolver;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 
@@ -47,12 +46,11 @@ class CityConsoleCommandResolver extends BaseCommandResolver implements CommandR
         * Creates an instance of a CityConsole command resolver with a given default command
         *
         * @param       $commandName                            The default command we shall execute
-        * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
         * @throws      EmptyVariableException          Thrown if default command is not set
         * @throws      InvalidCommandException         Thrown if default command is invalid
         */
-       public static final function createCityConsoleCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+       public static final function createCityConsoleCommandResolver ($commandName) {
                // Create the new instance
                $resolverInstance = new CityConsoleCommandResolver();
 
@@ -65,11 +63,11 @@ class CityConsoleCommandResolver extends BaseCommandResolver implements CommandR
                        throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
                }
 
-               // Set namespace and application instance
+               // Set namespace
                $resolverInstance->setNamespace('Org\Mxchange\City\Command');
-               $resolverInstance->setApplicationInstance($applicationInstance);
 
                // Return the prepared instance
                return $resolverInstance;
        }
+
 }
index 90ac6ffd48e10d1d51f9c5428e0e1147485c2268..4b7cac4842ed250f456999284f0f1b6af4e331ce 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\City\Resolver\Command;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Command\BaseCommandResolver;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 
@@ -47,12 +46,11 @@ class CityHtmlCommandResolver extends BaseCommandResolver implements CommandReso
         * Creates an instance of a CityHtml command resolver with a given default command
         *
         * @param       $commandName                            The default command we shall execute
-        * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
         * @throws      EmptyVariableException          Thrown if default command is not set
         * @throws      InvalidCommandException         Thrown if default command is invalid
         */
-       public static final function createCityHtmlCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+       public static final function createCityHtmlCommandResolver ($commandName) {
                // Create the new instance
                $resolverInstance = new CityHtmlCommandResolver();
 
@@ -65,11 +63,11 @@ class CityHtmlCommandResolver extends BaseCommandResolver implements CommandReso
                        throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
                }
 
-               // Set namespace and application instance
+               // Set namespace
                $resolverInstance->setNamespace('Org\Mxchange\City\Command');
-               $resolverInstance->setApplicationInstance($applicationInstance);
 
                // Return the prepared instance
                return $resolverInstance;
        }
+
 }
index 1fc1fbaf031f1281a2542623ba1c1266403a134d..dac203ac1c082208398e0be4410ec6c9ba737901 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\City\Resolver\Controller;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver;
 use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
 
@@ -47,12 +46,11 @@ class CityConsoleControllerResolver extends BaseControllerResolver implements Co
         * Creates an instance of a resolver class with a given controller
         *
         * @param       $controllerName                         The controller we shall resolve
-        * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
         * @throws      EmptyVariableException          Thrown if default controller is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
-       public static final function createCityConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+       public static final function createCityConsoleControllerResolver ($controllerName) {
                // Create the new instance
                $resolverInstance = new CityConsoleControllerResolver();
 
@@ -65,9 +63,6 @@ class CityConsoleControllerResolver extends BaseControllerResolver implements Co
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
-               // Set the application instance
-               $resolverInstance->setApplicationInstance($applicationInstance);
-
                // Set namespace and controller name
                $resolverInstance->setNamespace('Org\Mxchange\City\Controller');
                $resolverInstance->setControllerName($controllerName);
@@ -75,4 +70,5 @@ class CityConsoleControllerResolver extends BaseControllerResolver implements Co
                // Return the prepared instance
                return $resolverInstance;
        }
+
 }
index f7bcba43949f68d001274a7b0496060e043b16c4..c70016559a0cf9543fe0618e10aea8e4a164210e 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\City\Resolver\Controller;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver;
 use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
 
@@ -47,12 +46,11 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr
         * Creates an instance of a resolver class with a given controller
         *
         * @param       $controllerName                         The controller we shall resolve
-        * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
         * @throws      EmptyVariableException          Thrown if default controller is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
-       public static final function createCityHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+       public static final function createCityHtmlControllerResolver ($controllerName) {
                // Create the new instance
                $resolverInstance = new CityHtmlControllerResolver();
 
@@ -65,9 +63,6 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
-               // Set the application instance
-               $resolverInstance->setApplicationInstance($applicationInstance);
-
                // Set namespace and controller name
                $resolverInstance->setNamespace('Org\Mxchange\City\Controller');
                $resolverInstance->setControllerName($controllerName);
@@ -75,4 +70,5 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr
                // Return the prepared instance
                return $resolverInstance;
        }
+
 }
index 831d9adb49418a5751656ab7a02933414baae446..0c25ef1afa9dfd64895be6222028f35591422641 100644 (file)
@@ -3,7 +3,6 @@
 namespace Org\Mxchange\City\Resolver\Controller;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver;
 use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
 
@@ -47,12 +46,11 @@ class CityImageControllerResolver extends BaseControllerResolver implements Cont
         * Creates an instance of a resolver class with a given controller
         *
         * @param       $controllerName                         The controller we shall resolve
-        * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
         * @throws      EmptyVariableException          Thrown if default controller is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
-       public static final function createCityImageControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+       public static final function createCityImageControllerResolver ($controllerName) {
                // Create the new instance
                $resolverInstance = new CityImageControllerResolver();
 
@@ -65,9 +63,6 @@ class CityImageControllerResolver extends BaseControllerResolver implements Cont
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
-               // Set the application instance
-               $resolverInstance->setApplicationInstance($applicationInstance);
-
                // Set namespace and controller name
                $resolverInstance->setNamespace('Org\Mxchange\City\Controller');
                $resolverInstance->setControllerName($controllerName);
@@ -75,4 +70,5 @@ class CityImageControllerResolver extends BaseControllerResolver implements Cont
                // Return the prepared instance
                return $resolverInstance;
        }
+
 }
diff --git a/core b/core
index e137daa3a06f4b9e3767db913854c609383e8533..2b4f4b88ec5f9d385110e800494c680e164b5a36 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit e137daa3a06f4b9e3767db913854c609383e8533
+Subproject commit 2b4f4b88ec5f9d385110e800494c680e164b5a36
index 1e7f1d48f75e9a68e0803bef7bd71d416ff24fa6..e3c5da87df742caed7a31be487ec3306d16460a3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -137,7 +137,7 @@ final class ApplicationEntryPoint {
                                $applicationInstance = ApplicationHelper::getSelfInstance();
 
                                // Assign application data
-                               $templateInstance->assignApplicationData($applicationInstance);
+                               $templateInstance->assignApplicationData();
                        } // END - if
 
                        // We only try this