]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/resolver/action/web/class_WebActionResolver.php
Copyright year updated, converted double->single quotes
[core.git] / inc / classes / main / resolver / action / web / class_WebActionResolver.php
index 6276b11d694e39e28b24f2f89751f38442acc917..4f7086a72a0a24b4d59eff1cb8d73b41f1ea409b 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A action resolver for local (non-hubbed) actions
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
        /**
         * Last successfull resolved action
         */
-       private $lastActionInstance = "";
+       private $lastActionInstance = NULL;
 
        /**
         * Protected constructor
@@ -37,19 +37,19 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
                parent::__construct(__CLASS__);
 
                // Set prefix to "Web"
-               $this->setActionPrefix("Web");
+               $this->setClassPrefix('Web');
        }
 
        /**
         * Creates an instance of a Web action resolver with a given default action
         *
         * @param       $actionName                             The default action we shall execute
-        * @param       $appInstance                    An instance of a manageable application helper class
+        * @param       $applicationInstance    An instance of a manageable application helper class
         * @return      $resolverInstance               The prepared action resolver instance
         * @throws      EmptyVariableException  Thrown if default action is not set
         * @throws      InvalidActionException  Thrown if default action is invalid
         */
-       public final static function createWebActionResolver ($actionName, ManageableApplication $appInstance) {
+       public static final function createWebActionResolver ($actionName, ManageableApplication $applicationInstance) {
                // Create the new instance
                $resolverInstance = new WebActionResolver();
 
@@ -57,13 +57,13 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
                if (empty($actionName)) {
                        // Then thrown an exception here
                        throw new EmptyVariableException(array($resolverInstance, 'defaultAction'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } elseif ($resolverInstance->isActionValid($actionName) === false) {
+               } elseif ($resolverInstance->isActionValid($actionName) === FALSE) {
                        // Invalid action found
                        throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION);
                }
 
                // Set the application instance
-               $resolverInstance->setApplicationInstance($appInstance);
+               $resolverInstance->setApplicationInstance($applicationInstance);
 
                // Return the prepared instance
                return $resolverInstance;
@@ -82,17 +82,19 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
         */
        public function resolveActionByRequest (Requestable $requestInstance) {
                // Init variables
-               $actionName = "";
-               $actionInstance = null;
+               $actionName = '';
+               $actionInstance = NULL;
 
-               // This goes fine so let's resolv the action
+               // This goes fine so let's resolve the action
                $actionName = $requestInstance->getRequestElement('action');
 
                // Is the action empty? Then fall back to default action
-               if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
+               if (empty($actionName)) {
+                       $actionName = $this->getConfigInstance()->getConfigEntry('default_action');
+               } // END - if
 
                // Check if action is valid
-               if ($this->isActionValid($actionName) === false) {
+               if ($this->isActionValid($actionName) === FALSE) {
                        // This action is invalid!
                        throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
                } // END - if
@@ -107,7 +109,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
                } // END - if
 
                // Set last action
-               $this->lastActionInstance = $actionInstance;
+               $this->setResolvedInstance($actionInstance);
 
                // Return the resolved action instance
                return $actionInstance;
@@ -121,19 +123,21 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
         */
        public function resolveAction () {
                // Initiate the instance variable
-               $actionInstance = null;
+               $actionInstance = NULL;
 
                // Get action name
                $actionName = $this->getActionName();
 
                // Is the action empty? Then fall back to default action
-               if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
+               if (empty($actionName)) {
+                       $actionName = $this->getConfigInstance()->getConfigEntry('default_action');
+               } // END - if
 
                // Check if action is valid
-               if ($this->isActionValid($actionName) === false) {
+               if ($this->isActionValid($actionName) === FALSE) {
                        // This action is invalid!
                        throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
-               }
+               } // END - if
 
                // Get the action
                $actionInstance = $this->loadAction();