]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/resolver/class_BaseResolver.php
Continued:
[core.git] / framework / main / classes / resolver / class_BaseResolver.php
index ddbf41dd7993c64fc4d3a511fe676663105c6641..c92a0ab263bd386565c1ff7b10aaeb9c475c14c1 100644 (file)
@@ -1,17 +1,19 @@
 <?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
  *
@@ -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 <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
         */
@@ -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;
+       }
+
 }