]> git.mxchange.org Git - hub.git/commitdiff
Had to move more code into factory.
authorRoland Haeder <roland@mxchange.org>
Mon, 17 Mar 2014 22:05:53 +0000 (23:05 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 17 Mar 2014 22:05:53 +0000 (23:05 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/factories/node/class_NodeObjectFactory.php
application/hub/main/filter/node/class_NodeInitializationFilter.php

index 79af60dd2b15fc06d537b9493ad960083e1b3413..2a6d54f2ef2309eeb67b645b385fdded0f7dc4cc 100644 (file)
@@ -46,6 +46,21 @@ class NodeObjectFactory extends ObjectFactory {
                        // Get handler from registry
                        $nodeInstance = NodeObjectFactory::createNodeInstance();
                } elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) {
+                       // The default node-mode is from our configuration
+                       $nodeMode = $this->getConfigInstance()->getConfigEntry('node_default_mode');
+
+                       // Is the node 'mode' parameter set?
+                       if ($requestInstance->isRequestElementSet('mode')) {
+                               // Then use this which overrides the config entry temporarily
+                               $nodeMode = $requestInstance->getRequestElement('mode');
+                       } else {
+                               // Set it for easier re-usage
+                               $requestInstance->setRequestElement('mode', $nodeMode);
+                       }
+
+                       // Now convert the node-mode in a class name
+                       $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
+
                        // Get the node instance
                        $nodeInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
 
index 3070e8547946e74abe5303f034eb8df9d5a170f3..4064df324b6eabeaa1f851b8402cce5fa038125d 100644 (file)
@@ -53,23 +53,7 @@ class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // The default node-mode is from our configuration
-               $nodeMode = $this->getConfigInstance()->getConfigEntry('node_default_mode');
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Got default node mode ' . $nodeMode . ' from configuration.');
-
-               // Is the node 'mode' parameter set?
-               if ($requestInstance->isRequestElementSet('mode')) {
-                       // Then use this which overrides the config entry temporarily
-                       $nodeMode = $requestInstance->getRequestElement('mode');
-               } else {
-                       // Set it for easier re-usage
-                       $requestInstance->setRequestElement('mode', $nodeMode);
-               }
-
-               // Now convert the node-mode in a class name
-               $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
-
-               // And try to instance it
+               // Try to instance it by using a factory
                try {
                        // Get an instance
                        $nodeInstance = NodeObjectFactory::createNodeInstance($requestInstance, $responseInstance);