3 namespace CoreFramework\Resolver;
5 // Import framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
7 use CoreFramework\Object\BaseFrameworkSystem;
10 * A generic resolver class
12 * @author Roland Haeder <webmaster@shipsimu.org>
14 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
15 * @license GNU GPL 3.0 or any newer version
16 * @link http://www.shipsimu.org
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 class BaseResolver extends BaseFrameworkSystem {
35 private $namespace = '';
40 private $className = '';
45 private $classPrefix = '';
48 * (Last) resolved instance
50 private $resolvedInstance = NULL;
52 // Exception constants
53 const EXCEPTION_INVALID_COMMAND = 0x1d0;
54 const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
55 const EXCEPTION_INVALID_ACTION = 0x1d2;
56 const EXCEPTION_INVALID_STATE = 0x1d3;
59 * Protected constructor
61 * @param $className Real name of the class
64 protected function __construct ($className) {
65 // Call parent constructor
66 parent::__construct($className);
70 * Getter for namespace
72 * @return $namespace Namespace to look in
74 public final function getNamespace () {
75 return $this->namespace;
79 * Setter for namespace
81 * @param $namespace Namespace to look in
84 protected final function setNamespace ($namespace) {
85 $this->namespace = (string) $namespace;
89 * Getter for class name
91 * @return $className Name of the class
93 public final function getClassName () {
94 return $this->className;
98 * Setter for class name
100 * @param $className Name of the class
103 protected final function setClassName ($className) {
104 $this->className = (string) $className;
108 * "Getter" for class name (useable for an object factory)
110 * @return $className Capitalized class name
112 protected function getCapitalizedClassPrefix () {
114 $className = $this->getClassPrefix();
117 $className = self::convertToClassName($className);
124 * Getter for class prefix
126 * @return $classPrefix Last validated classPrefix
128 protected final function getClassPrefix () {
129 return $this->classPrefix;
133 * Setter for class prefix
135 * @param $classPrefix Last validated classPrefix
138 protected final function setClassPrefix ($classPrefix) {
139 $this->classPrefix = (string) $classPrefix;
143 * Getter for (last) resolved instance
145 * @return $resolvedInstance Last validated resolvedInstance
147 protected final function getResolvedInstance () {
148 return $this->resolvedInstance;
152 * Setter for (last) resolved instance
154 * @param $resolvedInstance (Last) validated resolved instance
157 protected final function setResolvedInstance (FrameworkInterface $resolvedInstance) {
158 $this->resolvedInstance = $resolvedInstance;