]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/filter/node/class_NodeInitializationFilter.php
Introduced NodeObjectFactory to encapsulate (and ease) a lot calls.
[hub.git] / application / hub / main / filter / node / class_NodeInitializationFilter.php
index f302ebcfce8a8b965dbd9a18aba10f96e3fc58f9..3070e8547946e74abe5303f034eb8df9d5a170f3 100644 (file)
@@ -55,7 +55,7 @@ class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
        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('[INIT:] Got default node mode ' . $nodeMode . ' from configuration.');
+               //* 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')) {
@@ -72,16 +72,7 @@ class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
                // And try to instance it
                try {
                        // Get an instance
-                       $nodeInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
-
-                       // Get a registry
-                       $applicationInstance = Registry::getRegistry()->getInstance('app');
-
-                       // Set the app instance
-                       $nodeInstance->setApplicationInstance($applicationInstance);
-
-                       // Add node-specific filters
-                       $nodeInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
+                       $nodeInstance = NodeObjectFactory::createNodeInstance($requestInstance, $responseInstance);
                } catch (ClassNotFoundException $e) {
                        // This exception means, the node mode is invalid.
                        // @TODO Can we rewrite this to app_exit() ?
@@ -90,7 +81,7 @@ class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
 
                // Set the node instance in registry
                Registry::getRegistry()->addInstance('node', $nodeInstance);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[INIT:] Node ' . $nodeMode . ' has been added to registry.');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Node ' . $nodeMode . ' has been added to registry.');
        }
 }