]> git.mxchange.org Git - shipsimu.git/blobdiff - application/selector/class_ApplicationSelector.php
More exceptions added, init of template engine moved to base class, entryPoint()...
[shipsimu.git] / application / selector / class_ApplicationSelector.php
index f4515e2dbcef1855a1e4c738ed3ed9994d2b4594..c47ef8785503dd929dd57656beee7c71a22f5f4a 100644 (file)
@@ -49,16 +49,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
                ".htaccess"
        );
 
-       /**
-        * The language instance for the template loader
-        */
-       private $langInstance = null;
-
-       /**
-        * The file I/O instance for the template loader
-        */
-       private $fileIOInstance = null;
-
        /**
         * The private constructor. No direct instances can be created from this.
         *
@@ -123,80 +113,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
                $this->loadedTemplates = new FrameworkArrayObject();
        }
 
-       /**
-        * Private getter for language instance
-        *
-        * @return      $langInstance   An instance to the language sub-system
-        */
-       private function getLanguageInstance () {
-               return $this->langInstance;
-       }
-
-       /**
-        * Private getter for file IO instance
-        *
-        * @return      $fileIOInstance An instance to the file I/O sub-system
-        */
-       private function getFileIOInstance () {
-               return $this->fileIOInstance;
-       }
-
-       /**
-        * Prepare the template engine (TemplateEngine by default) for a give
-        * application helper instance (ApplicationHelper by default).
-        *
-        * @param               $appInstance    An application helper instance
-        * @return              $tplEngine      The template engine instance
-        * @throws              NullPointerException    If the template engine could not
-        *                                                                              be initialized
-        * @throws              UnsupportedTemplateEngineException      If $tplEngine is an
-        *                                                                              unsupported template engine
-        */
-       private function prepareTemplateEngine (BaseFrameworkSystem $appInstance) {
-               // Generate FQFN for all application templates
-               $fqfn = sprintf("%s%s/%s/%s",
-                       PATH,
-                       $this->getConfigInstance()->readConfig("application_path"),
-                       strtolower($appInstance->getAppShortName()),
-                       $this->getConfigInstance()->readConfig("tpl_base_path")
-               );
-
-               // Initialize the template engine
-               $tplEngine = null;
-               $eval = sprintf("\$tplEngine = %s::create%s(
-       \"%s\",
-       \$this->getLanguageInstance(),
-       \$this->getFileIOInstance()
-);",
-                       $this->getConfigInstance()->readConfig("tpl_engine"),
-                       $this->getConfigInstance()->readConfig("tpl_engine"),
-                       $fqfn
-               );
-
-               // Debug message
-               if ((!is_null($this->getDebugInstance())) && (defined('DEBUG_EVAL'))) {
-                       $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
-                               $this->__toString(),
-                               htmlentities($eval)
-                       ));
-               }
-
-               // Run the command
-               @eval($eval);
-
-               // Is it a valid instance?
-               if (is_null($tplEngine)) {
-                       // No class returned
-                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!$tplEngine instanceof CompileableTemplate) {
-                       // Not an object! ;-(
-                       throw new UnsupportedTemplateEngineException($tplEngine, self::EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED);
-               }
-
-               // Return the prepared instance
-               return $tplEngine;
-       }
-
        /**
         * Load the init.php script of an application and append the application
         * instance to $foundApps
@@ -269,7 +185,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *
         * @return      $shortName      This selector's short name
         */
-       private function getAppShortName() {
+       public function getAppShortName() {
                $shortName = $this->getConfigInstance()->readConfig("selector_path");
                return $shortName;
        }
@@ -286,27 +202,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
                $this->dirIgnoreList[] = $ignoreItem;
        }
 
-       /**
-        * Setter for language instance
-        *
-        * @param               $langInstance   An instance to the language sub-system
-        * @return      void
-        * @see         LanguageSystem
-        */
-       public final function setLanguageInstance (ManageableLanguage $langInstance) {
-               $this->langInstance = $langInstance;
-       }
-
-       /**
-        * Setter for file I/O instance
-        *
-        * @param               $fileIOInstance An instance to the file I/O sub-system
-        * @return      void
-        */
-       public final function setFileIOInstance (FileIOHandler $fileIOInstance) {
-               $this->fileIOInstance = $fileIOInstance;
-       }
-
        /**
         * Read the base path for all applications (application/) and create a
         * list of all found applications