]> git.mxchange.org Git - hub.git/commitdiff
No 'this' in static methods. ;-)
authorRoland Haeder <roland@mxchange.org>
Mon, 17 Mar 2014 22:07:24 +0000 (23:07 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 17 Mar 2014 22:07:24 +0000 (23:07 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/factories/node/class_NodeObjectFactory.php

index 2a6d54f2ef2309eeb67b645b385fdded0f7dc4cc..3b676eb7a8b841ce87f0b7e5d42248dab42471de 100644 (file)
@@ -41,13 +41,16 @@ class NodeObjectFactory extends ObjectFactory {
         * @throws      FactoryRequiredParameterException       If not all parameters are set and no instance 'node' is set.
         */
        public static final function createNodeInstance (Requestable $requestInstance = NULL, Responseable $responseInstance = NULL) {
+               // Get new factory instance
+               $factoryInstance = new NodeObjectFactory();
+
                // If there is no handler?
                if (Registry::getRegistry()->instanceExists('node')) {
                        // 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');
+                       $nodeMode = $factoryInstance->getConfigInstance()->getConfigEntry('node_default_mode');
 
                        // Is the node 'mode' parameter set?
                        if ($requestInstance->isRequestElementSet('mode')) {
@@ -59,7 +62,7 @@ class NodeObjectFactory extends ObjectFactory {
                        }
 
                        // Now convert the node-mode in a class name
-                       $className = 'Hub' . $this->convertToClassName($nodeMode) . 'Node';
+                       $className = 'Hub' . $factoryInstance->convertToClassName($nodeMode) . 'Node';
 
                        // Get the node instance
                        $nodeInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
@@ -77,7 +80,7 @@ class NodeObjectFactory extends ObjectFactory {
                        Registry::getRegistry()->addInstance('node', $nodeInstance);
                } else {
                        // Throw an exception here
-                       throw new FactoryRequiredParameterException(new NodeObjectFactory(), self::EXCEPTION_FACTORY_REQUIRE_PARAMETER);
+                       throw new FactoryRequiredParameterException($factoryInstance, self::EXCEPTION_FACTORY_REQUIRE_PARAMETER);
                }
 
                // Return the instance