Also this must be "namespaced" ;-)
[core.git] / application / tests / class_ApplicationHelper.php
index 9587ab482e0b03e7169b1233240dac2db0801c41..20cfaeafe778e5e611b9d389ddab35f80a116e89 100644 (file)
@@ -1,4 +1,15 @@
 <?php
+// Own namespace
+namespace CoreFramework\Helper\Application;
+
+// Import framework stuff
+use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Object\BaseFrameworkSystem;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Registry\Registerable;
+use CoreFramework\Registry\Generic\Registry;
+use CoreFramework\Template\CompileableTemplate;
+
 /**
  * A class holding general data about the application and some methods for
  * the management including the entry point.
@@ -22,7 +33,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  *
  * This program is free software: you can redistribute it and/or modify
@@ -157,7 +168,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                $responseType = self::getResponseTypeFromSystem();
 
                // Create a new request object
-               $requestInstance = ObjectFactory::createObjectByName(self::convertToClassName($response) . 'Request');
+               $requestInstance = ObjectFactory::createObjectByName(sprintf('CoreFramework\Request\%sRequest', self::convertToClassName($response)));
 
                // Remember request instance here
                $this->setRequestInstance($requestInstance);
@@ -170,7 +181,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                } // END - if
 
                // ... and a new response object
-               $responseClass = sprintf('%sResponse', self::convertToClassName($response));
+               $responseClass = sprintf('CoreFramework\Response\%sResponse', self::convertToClassName($response));
                $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
 
                // Remember response instance here
@@ -189,7 +200,14 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                } // END - if
 
                // Get a controller resolver
-               $resolverClass = self::convertToClassName($this->getAppShortName() . '_' . $responseType . '_controller_resolver');
+               $resolverClass = sprintf(
+                       'CoreFramework\Resolver\Controller\%s',
+                       self::convertToClassName(sprintf(
+                               '%s_%s_controller_resolver',
+                               $this->getAppShortName(),
+                               $responseType
+                       ))
+               );
                $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
 
                // Get a controller instance as well
@@ -201,9 +219,9 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // -------------------------- Shutdown phase --------------------------
                // Shutting down the hub by saying "good bye" to all connected peers
                // and other hubs, flushing all queues and caches.
-               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown in progress, main loop exited.');
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown in progress, main loop exited.');
                $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
-               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
        }
 
        /**
@@ -239,7 +257,5 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        public function assignExtraTemplateData (CompileableTemplate $templateInstance) {
                $this->partialStub('Unfinished method. templateInstance=' . $templateInstance->__toString());
        }
-}
 
-// [EOF]
-?>
+}