]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/resolver/controller/class_BaseControllerResolver.php
More conventions than code added:
[shipsimu.git] / inc / classes / main / resolver / controller / class_BaseControllerResolver.php
index 1b5fa1c42c2789647ca278e56ec3c122e3225f58..c34d5cab9197512b9f1a62dadf462947543951d2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -56,7 +56,7 @@ class BaseControllerResolver extends BaseResolver {
        /**
         * Setter for controller name
         *
-        * @param       $controllerName Last validated controller name
+        * @param       $controllerName         Last validated controller name
         * @return      void
         */
        protected final function setControllerName ($controllerName) {
@@ -68,16 +68,17 @@ class BaseControllerResolver extends BaseResolver {
         *
         * @return      $controllerName Last validated controller name
         */
-       protected final function getControllerName () {
+       public final function getControllerName () {
                return $this->controllerName;
        }
 
        /**
         * Checks wether the given controller is valid
         *
-        * @param       $controllerName The default controller we shall execute
-        * @return      $isValid                Wether the given controller is valid
+        * @param       $controllerName         The default controller we shall execute
+        * @return      $isValid                        Wether the given controller is valid
         * @throws      EmptyVariableException  Thrown if the given controller is not set
+        * @throws      DefaultControllerException      If the default controller was not found
         */
        public function isControllerValid ($controllerName) {
                // By default nothing shall be valid
@@ -101,18 +102,18 @@ class BaseControllerResolver extends BaseResolver {
                        if (class_exists($this->getClassName())) {
                                // This class does exist. :-)
                                $isValid = true;
-                       } elseif (($this->getClassName() != "WebDefaultController") && ($this->getClassName() != "WebDefaultNewsController")) {
+                       } elseif (($this->getClassName() != $this->controllerPrefix.'DefaultController') && ($this->getClassName() != $this->controllerPrefix.'DefaultNewsController')) {
                                // Do we have news?
                                if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
                                        // Yes, display news in home then set default controller with news
-                                       $this->setClassName("WebDefaultNewsController");
+                                       $this->setClassName($this->controllerPrefix.'DefaultNewsController');
                                } else {
-                                       // No news at "home" page or non-news page
-                                       $this->setClassName("WebDefaultController");
+                                       // No news at home page or non-news page
+                                       $this->setClassName($this->controllerPrefix.'DefaultController');
                                }
                        } else {
                                // All is tried, give it up here
-                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
                        }
                } // END - while