X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Fresolver%2Fclass_BaseResolver.php;h=c92a0ab263bd386565c1ff7b10aaeb9c475c14c1;hb=d0e81e7bbac523be5f906410a6a6399c6347e27e;hp=ddbf41dd7993c64fc4d3a511fe676663105c6641;hpb=78a010fef84895720e796842208f01dfb619c332;p=core.git diff --git a/framework/main/classes/resolver/class_BaseResolver.php b/framework/main/classes/resolver/class_BaseResolver.php index ddbf41dd..c92a0ab2 100644 --- a/framework/main/classes/resolver/class_BaseResolver.php +++ b/framework/main/classes/resolver/class_BaseResolver.php @@ -1,17 +1,19 @@ * @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 * @@ -28,7 +30,13 @@ use CoreFramework\Object\BaseFrameworkSystem; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -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 */ @@ -49,11 +57,10 @@ class BaseResolver extends BaseFrameworkSystem { */ 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 @@ -61,7 +68,7 @@ class BaseResolver extends BaseFrameworkSystem { * @param $className Real name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } @@ -81,8 +88,8 @@ class BaseResolver extends BaseFrameworkSystem { * @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; } /** @@ -100,8 +107,8 @@ class BaseResolver extends BaseFrameworkSystem { * @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; } /** @@ -114,7 +121,7 @@ class BaseResolver extends BaseFrameworkSystem { $className = $this->getClassPrefix(); // And capitalize it - $className = self::convertToClassName($className); + $className = StringUtils::convertToClassName($className); // Return it return $className; @@ -158,4 +165,23 @@ class BaseResolver extends BaseFrameworkSystem { $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; + } + }