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 $className = '';
40 private $classPrefix = '';
43 * (Last) resolved instance
45 private $resolvedInstance = NULL;
47 // Exception constants
48 const EXCEPTION_INVALID_COMMAND = 0x1d0;
49 const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
50 const EXCEPTION_INVALID_ACTION = 0x1d2;
51 const EXCEPTION_INVALID_STATE = 0x1d3;
54 * Protected constructor
56 * @param $className Real name of the class
59 protected function __construct ($className) {
60 // Call parent constructor
61 parent::__construct($className);
65 * Getter for class name
67 * @return $className Name of the class
69 public final function getClassName () {
70 return $this->className;
74 * "Getter" for class name (useable for an object factory)
76 * @return $className Capitalized class name
78 protected function getCapitalizedClassPrefix () {
80 $className = $this->getClassPrefix();
83 $className = self::convertToClassName($className);
90 * Setter for class name
92 * @param $className Name of the class
95 protected final function setClassName ($className) {
96 $this->className = (string) $className;
100 * Getter for class prefix
102 * @return $classPrefix Last validated classPrefix
104 protected final function getClassPrefix () {
105 return $this->classPrefix;
109 * Setter for class prefix
111 * @param $classPrefix Last validated classPrefix
114 protected final function setClassPrefix ($classPrefix) {
115 $this->classPrefix = (string) $classPrefix;
119 * Getter for (last) resolved instance
121 * @return $resolvedInstance Last validated resolvedInstance
123 protected final function getResolvedInstance () {
124 return $this->resolvedInstance;
128 * Setter for (last) resolved instance
130 * @param $resolvedInstance (Last) validated resolved instance
133 protected final function setResolvedInstance (FrameworkInterface $resolvedInstance) {
134 $this->resolvedInstance = $resolvedInstance;