Code sync from ship-simu code (all class config entries must end with _class!)
[mailer.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 2a0c80768b2b2c7fd2928af4a88e30716f82d640..3484a4eb5a9dc5724e37525bfe81954e230114a0 100644 (file)
@@ -32,6 +32,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * The language instance for the template loader
         */
        private static $langInstance = null;
+       /**
+        * Instance of a request class
+        */
+       private $requestInstance = null;
+
+       /**
+        * Instance of a response class
+        */
+       private $responseInstance = null;
 
        /**
         * The real class name
@@ -61,7 +70,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * The file I/O instance for the template loader
         */
-       private $fileIOInstance = null;
+       private $fileIoInstance = null;
 
        /***********************
         * Exception codes.... *
@@ -267,7 +276,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class');
 
                        // Set debug instance
-                       $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine')));
+                       $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_class')));
 
                        // Get output instance and set it
                        $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
@@ -407,6 +416,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                self::$applicationInstance = $applicationInstance;
        }
 
+       /**
+        * Setter for request instance
+        *
+        * @param       $requestInstance        An instance of a Requestable class
+        * @return      void
+        */
+       public final function setRequestInstance (Requestable $requestInstance) {
+               $this->requestInstance = $requestInstance;
+       }
+
+       /**
+        * Getter for request instance
+        *
+        * @return      $requestInstance        An instance of a Requestable class
+        */
+       public final function getRequestInstance () {
+               return $this->requestInstance;
+       }
+
+       /**
+        * Setter for response instance
+        *
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      void
+        */
+       public final function setResponseInstance (Responseable $responseInstance) {
+               $this->responseInstance = $responseInstance;
+       }
+
+       /**
+        * Getter for response instance
+        *
+        * @return      $responseInstance       An instance of a Responseable class
+        */
+       public final function getResponseInstance () {
+               return $this->responseInstance;
+       }
+
        /**
         * Getter for $realClass
         *
@@ -758,20 +805,20 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Private getter for file IO instance
         *
-        * @return      $fileIOInstance An instance to the file I/O sub-system
+        * @return      $fileIoInstance An instance to the file I/O sub-system
         */
        protected final function getFileIoInstance () {
-               return $this->fileIOInstance;
+               return $this->fileIoInstance;
        }
 
        /**
         * Setter for file I/O instance
         *
-        * @param       $fileIOInstance An instance to the file I/O sub-system
+        * @param       $fileIoInstance An instance to the file I/O sub-system
         * @return      void
         */
-       public final function setFileIoInstance (FileIoHandler $fileIOInstance) {
-               $this->fileIOInstance = $fileIOInstance;
+       public final function setFileIoInstance (FileIoHandler $fileIoInstance) {
+               $this->fileIoInstance = $fileIoInstance;
        }
 
        /**
@@ -821,7 +868,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                }
 
                // Initialize the template engine
-               $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
+               $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
 
                // Return the prepared instance
                return $tplEngine;
@@ -886,10 +933,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $className      Generated class name
         */
        public function convertToClassName ($str) {
+               // Init class name
                $className = "";
+
+               // Convert all dashes in underscores
+               $str = str_replace("-", "_", $str);
+
+               // Now use that underscores to get classname parts for hungarian style
                foreach (explode("_", $str) as $strPart) {
+                       // Make the class name part lower case and first upper case
                        $className .= ucfirst(strtolower($strPart));
-               }
+               } // END - foreach
+
+               // Return class name
                return $className;
        }