/**
* A generic controller resolver class
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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
/**
* "Loads" a given controller and instances it if not yet cached. If the
* controller was not found one of the default controllers will be used
- * depending on wether news shall be displayed.
+ * depending on whether news shall be displayed.
*
* @param $controllerName A controller name we shall look for
* @return $controllerInstance A loaded controller instance
$defaultController = $this->getConfigInstance()->getConfigEntry('default_' . strtolower($this->getClassPrefix()) . '_command');
// Init controller instance
- $controllerInstance = null;
+ $controllerInstance = NULL;
// Default controller
$this->setClassName($this->getClassPrefix() . 'DefaultNewsController');
// Generate the class name
- //* DEBUG: */ $this->debugOutput('BEFORE: controller=' . $controllerName);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BEFORE: controller=' . $controllerName);
if ($controllerName != $defaultController) {
// Create controller class name
$className = $this->getClassPrefix() . $this->convertToClassName($controllerName) . 'Controller';
// No news at main command or non-news command
$this->setClassName($this->getClassPrefix() . 'DefaultNewsController');
}
- //* DEBUG: */ $this->debugOutput('AFTER: controller=' . $this->getClassName());
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('AFTER: controller=' . $this->getClassName());
// Is this class loaded?
if (!class_exists($this->getClassName())) {
}
/**
- * Checks wether the given controller is valid
+ * Checks whether the given controller is valid
*
* @param $controllerName The default controller we shall execute
- * @return $isValid Wether the given controller is valid
+ * @return $isValid Whether the given controller is valid
* @throws EmptyVariableException Thrown if given controller is not set
* @throws DefaultControllerException Thrown if default controller was not found
*/
public function isControllerValid ($controllerName) {
// By default nothing shall be valid
- $isValid = false;
+ $isValid = FALSE;
// Is a controller set?
if (empty($controllerName)) {
$this->setClassName($className);
// Try it hard to get an controller
- while ($isValid === false) {
+ while ($isValid === FALSE) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
- $isValid = true;
+ $isValid = TRUE;
} elseif ($this->getClassName() != $this->getClassPrefix() . 'DefaultNewsController') {
// Set default controller
$this->setClassName($this->getClassPrefix() . 'DefaultNewsController');