<?php
// Own namespace
-namespace CoreFramework\Resolver;
+namespace Org\Mxchange\CoreFramework\Resolver;
// Import framework stuff
-use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
/**
* A generic resolver class
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class BaseResolver extends BaseFrameworkSystem {
+abstract class BaseResolver extends BaseFrameworkSystem {
+ // Exception constants
+ const EXCEPTION_INVALID_COMMAND = 0x1d0;
+ const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
+ const EXCEPTION_INVALID_ACTION = 0x1d2;
+ const EXCEPTION_INVALID_STATE = 0x1d3;
+
/**
* Namespace
*/
*/
private $resolvedInstance = NULL;
- // Exception constants
- const EXCEPTION_INVALID_COMMAND = 0x1d0;
- const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
- const EXCEPTION_INVALID_ACTION = 0x1d2;
- const EXCEPTION_INVALID_STATE = 0x1d3;
+ /**
+ * A controller instance
+ */
+ private $controllerInstance = NULL;
/**
* Protected constructor
* @param $className Real name of the class
* @return void
*/
- protected function __construct ($className) {
+ protected function __construct (string $className) {
// Call parent constructor
parent::__construct($className);
}
* @param $namespace Namespace to look in
* @return void
*/
- protected final function setNamespace ($namespace) {
- $this->namespace = (string) $namespace;
+ protected final function setNamespace (string $namespace) {
+ $this->namespace = $namespace;
}
/**
* @param $className Name of the class
* @return void
*/
- protected final function setClassName ($className) {
- $this->className = (string) $className;
+ protected final function setClassName (string $className) {
+ $this->className = $className;
}
/**
$className = $this->getClassPrefix();
// And capitalize it
- $className = self::convertToClassName($className);
+ $className = StringUtils::convertToClassName($className);
// Return it
return $className;
$this->resolvedInstance = $resolvedInstance;
}
+ /**
+ * Setter for controller instance (this surely breaks a bit the MVC patterm)
+ *
+ * @param $controllerInstance An instance of the controller
+ * @return void
+ */
+ public final function setControllerInstance (Controller $controllerInstance) {
+ $this->controllerInstance = $controllerInstance;
+ }
+
+ /**
+ * Getter for controller instance (this surely breaks a bit the MVC patterm)
+ *
+ * @return $controllerInstance An instance of the controller
+ */
+ public final function getControllerInstance () {
+ return $this->controllerInstance;
+ }
+
}