3 namespace Org\Mxchange\CoreFramework\Resolver;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
7 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
8 use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
11 * A generic resolver class
13 * @author Roland Haeder <webmaster@shipsimu.org>
15 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
16 * @license GNU GPL 3.0 or any newer version
17 * @link http://www.shipsimu.org
19 * This program is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation, either version 3 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 abstract class BaseResolver extends BaseFrameworkSystem {
33 // Exception constants
34 const EXCEPTION_INVALID_COMMAND = 0x1d0;
35 const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
36 const EXCEPTION_INVALID_ACTION = 0x1d2;
37 const EXCEPTION_INVALID_STATE = 0x1d3;
42 private $namespace = '';
47 private $className = '';
52 private $classPrefix = '';
55 * (Last) resolved instance
57 private $resolvedInstance = NULL;
60 * Protected constructor
62 * @param $className Real name of the class
65 protected function __construct (string $className) {
66 // Call parent constructor
67 parent::__construct($className);
71 * Getter for namespace
73 * @return $namespace Namespace to look in
75 public final function getNamespace () {
76 return $this->namespace;
80 * Setter for namespace
82 * @param $namespace Namespace to look in
85 protected final function setNamespace (string $namespace) {
86 $this->namespace = $namespace;
90 * Getter for class name
92 * @return $className Name of the class
94 public final function getClassName () {
95 return $this->className;
99 * Setter for class name
101 * @param $className Name of the class
104 protected final function setClassName (string $className) {
105 $this->className = $className;
109 * "Getter" for class name (useable for an object factory)
111 * @return $className Capitalized class name
113 protected function getCapitalizedClassPrefix () {
115 $className = $this->getClassPrefix();
118 $className = StringUtils::convertToClassName($className);
125 * Getter for class prefix
127 * @return $classPrefix Last validated classPrefix
129 protected final function getClassPrefix () {
130 return $this->classPrefix;
134 * Setter for class prefix
136 * @param $classPrefix Last validated classPrefix
139 protected final function setClassPrefix (string $classPrefix) {
140 $this->classPrefix = $classPrefix;
144 * Getter for (last) resolved instance
146 * @return $resolvedInstance Last validated resolvedInstance
148 protected final function getResolvedInstance () {
149 return $this->resolvedInstance;
153 * Setter for (last) resolved instance
155 * @param $resolvedInstance (Last) validated resolved instance
158 protected final function setResolvedInstance (FrameworkInterface $resolvedInstance) {
159 $this->resolvedInstance = $resolvedInstance;