Code cleanup in application selector. TODO: Application 'admin' needs to be excluded...
[shipsimu.git] / application / selector / class_ApplicationSelector.php
index f52b50a8fe16b3debf369defca694a9318e0fbc5..3c4b256b9ac1d6d7ee935dded207a5a89a5b0739 100644 (file)
@@ -35,11 +35,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
         */
        private $loadedTemplates = null;
 
-       /**
-        * The application selector's own template engine handler
-        */
-       private $selectorTplEngine = null;
-
        /**
         * A list of items we shall ignore while reading from directories
         */
@@ -124,29 +119,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                        // Add the current instance to the list
                        $this->foundApps->append($app);
-
                } // END - if ((is_file(...
        }
 
-       /**
-        * Setter for the selector's template engine instance
-        *
-        * @param       $templateInstance       An instance of TemplateEngine
-        * @return      void
-        */
-       private final function setSelectorTemplateEngine (CompileableTemplate $templateInstance) {
-               $this->selectorTplEngine = $templateInstance;
-       }
-
-       /**
-        * Getter for the selector's template engine instance
-        *
-        * @return      $selectTplEngine        The selector's template engine
-        */
-       private final function getSelectorTemplateEngine () {
-               return $this->selectorTplEngine;
-       }
-
        /**
         * Getter for the $loadedTemplates array object
         *
@@ -175,8 +150,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         */
        public function addDirIgnoreList ($ignoreItem) {
                // Cast and add it
-               $ignoreItem = (string) $ignoreItem;
-               $this->dirIgnoreList[] = $ignoreItem;
+               $this->dirIgnoreList[] = (string) $ignoreItem;
        }
 
        /**
@@ -195,10 +169,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
                // Get a directory pointer for the application path
                $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath);
 
-               // Backup and remove the 'app' from local name space
-               /*$appBackup = $app;
-               unset($app);*/
-
                // Read all directories&files except some parts
                while ($appName = $dirInstance->readDirectoryExcept($this->dirIgnoreList)) {
                        // Generate FQFN for the application name (or better directory name)
@@ -217,9 +187,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                // Close directory pointer
                $dirInstance->closeDirectory();
-
-               // Restore old 'app' from backup
-               //$app = $appBackup;
        }
 
        /**
@@ -275,8 +242,8 @@ class ApplicationSelector extends BaseFrameworkSystem {
                // Load the selector's template
                $templateInstance->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_main_tpl'));
 
-               // Now store it in the class
-               $this->setSelectorTemplateEngine($templateInstance);
+               // Now store it in the class, we need this later on final compilation of available applications
+               $this->setTemplateInstance($templateInstance);
        }
 
        /**
@@ -289,6 +256,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *                                                                              unexpected count of elements
         * @throws      MissingArrayElementsException   If $curr is missing expected
         *                                                                                      array elements
+        * @todo        Finish handling all applications here
         */
        public function insertApplicationTemplates () {
                // First prepare the instance
@@ -317,8 +285,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
                                // Expected entries missing
                                throw new MissingArrayElementsException(array($this, "curr", array("template_class", "app_instance")), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
                        }
-                       die("<pre>".print_r($curr, true)."</pre>");
 
+                       // Debug output
+                       die(__METHOD__."()<pre>".print_r($curr, true)."</pre>");
                } // END - for
        }
 }