/**
* 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
/**
* Last successfull resolved action
*/
- private $lastActionInstance = "";
+ private $lastActionInstance = NULL;
/**
* Protected constructor
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();
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;
*/
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
} // END - if
// Set last action
- $this->lastActionInstance = $actionInstance;
+ $this->setResolvedInstance($actionInstance);
// Return the resolved action instance
return $actionInstance;
*/
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();