Some cleanups
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index 656e3cdc4fb603a6d1a6215551458e8b5661a32f..6cc07b23a42816073734a0df3b6d8adb36966fe4 100644 (file)
@@ -197,8 +197,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_ATTRIBUTES_ARE_MISSING       = 0x02b;
        const EXCEPTION_ARRAY_ELEMENTS_MISSING       = 0x02c;
        const EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED  = 0x02d;
-       const EXCEPTION_MISSING_LANGUAGE_HANDLER     = 0x02e;
-       const EXCEPTION_MISSING_FILE_IO_HANDLER      = 0x02f;
        const EXCEPTION_MISSING_ELEMENT              = 0x030;
        const EXCEPTION_HEADERS_ALREADY_SENT         = 0x031;
        const EXCEPTION_DEFAULT_CONTROLLER_GONE      = 0x032;
@@ -626,7 +624,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                if ((!isset($this->decimals)) || (!isset($this->thousands))) {
                        // Throw an exception
                        throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING);
-               }
+               } // END - if
 
                // Cast the number
                $value = (float) $value;
@@ -667,7 +665,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public final function addMissingTrailingSlash ($str) {
                // Is there a trailing slash?
-               if (substr($str, -1, 1) != '/') $str .= '/';
+               if (substr($str, -1, 1) != '/') {
+                       $str .= '/';
+               } // END - if
+
+               // Return string with trailing slash
                return $str;
        }
 
@@ -694,42 +696,27 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * Prepare the template engine (WebTemplateEngine by default) for a given
         * application helper instance (ApplicationHelper by default).
         *
-        * @param               $appInstance                    An application helper instance or
+        * @param               $applicationInstance    An application helper instance or
         *                                                                              null if we shall use the default
-        * @return              $templateInstance                               The template engine instance
-        * @throws              NullPointerException    If the template engine could not
-        *                                                                              be initialized
-        * @throws              UnsupportedTemplateEngineException      If $templateInstance is an
-        *                                                                              unsupported template engine
-        * @throws              MissingLanguageHandlerException If the language sub-system
-        *                                                                              is not yet initialized
+        * @return              $templateInstance               The template engine instance
         * @throws              NullPointerException    If the discovered application
         *                                                                              instance is still null
         */
-       protected function prepareTemplateInstance (FrameworkInterface $appInstance=null) {
+       protected function prepareTemplateInstance (ManageableApplication $applicationInstance = null) {
                // Is the application instance set?
-               if (is_null($appInstance)) {
+               if (is_null($applicationInstance)) {
                        // Get the current instance
-                       $appInstance = $this->getApplicationInstance();
+                       $applicationInstance = $this->getApplicationInstance();
 
                        // Still null?
-                       if (is_null($appInstance)) {
+                       if (is_null($applicationInstance)) {
                                // Thrown an exception
                                throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
                        } // END - if
                } // END - if
 
-               // Are both instances set?
-               if ($appInstance->getLanguageInstance() === null) {
-                       // Invalid language instance
-                       throw new MissingLanguageHandlerException($appInstance, self::EXCEPTION_MISSING_LANGUAGE_HANDLER);
-               } elseif ($appInstance->getFileIoInstance() === null) {
-                       // Invalid language instance
-                       throw new MissingFileIoHandlerException($appInstance, self::EXCEPTION_MISSING_FILE_IO_HANDLER);
-               }
-
                // Initialize the template engine
-               $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class', array($appInstance));
+               $templateInstance = ObjectFactory::createObjectByConfiguredName('web_template_class');
 
                // Return the prepared instance
                return $templateInstance;
@@ -803,7 +790,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Generate the class::method string
                $methodName = 'UnknownClass->unknownMethod';
                if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
-                       $methodName = $backtrace[1]['class']."->".$backtrace[1]['function'];
+                       $methodName = $backtrace[1]['class'] . '->' . $backtrace[1]['function'];
                } // END - if
 
                // Construct the full message
@@ -823,7 +810,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $this->debugOutput($stubMessage);
                } else {
                        // Trigger an error
-                       trigger_error($stubMessage."<br />\n");
+                       trigger_error($stubMessage . "<br />\n");
                }
        }
 
@@ -855,7 +842,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                if (is_object($debugInstance)) {
                        // Use debug output handler
                        $debugInstance->output($message);
-                       if ($doPrint === false) die(); // Die here if not printed
+
+                       if ($doPrint === false) {
+                               // Die here if not printed
+                               die();
+                       } // END - if
                } else {
                        // Put directly out
                        if ($doPrint === true) {
@@ -1150,7 +1141,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                                $this->debugOutput($message);
                        } else {
                                // Trigger an error
-                               trigger_error($message."<br />\n");
+                               trigger_error($message . "<br />\n");
                        }
                } else {
                        // @TODO Finish this part!