* @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')) {
}
// 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));
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