3 namespace CoreFramework\Resolver;
5 // Load framework stuff
6 use CoreFramework\Generic\FrameworkInterface;
9 * A generic resolver class
11 * @author Roland Haeder <webmaster@shipsimu.org>
13 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
14 * @license GNU GPL 3.0 or any newer version
15 * @link http://www.shipsimu.org
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 class BaseResolver extends BaseFrameworkSystem {
34 private $className = '';
39 private $classPrefix = '';
42 * (Last) resolved instance
44 private $resolvedInstance = NULL;
46 // Exception constants
47 const EXCEPTION_INVALID_COMMAND = 0x1d0;
48 const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
49 const EXCEPTION_INVALID_ACTION = 0x1d2;
50 const EXCEPTION_INVALID_STATE = 0x1d3;
53 * Protected constructor
55 * @param $className Real name of the class
58 protected function __construct ($className) {
59 // Call parent constructor
60 parent::__construct($className);
64 * Getter for class name
66 * @return $className Name of the class
68 public final function getClassName () {
69 return $this->className;
73 * "Getter" for class name (useable for an object factory)
75 * @return $className Capitalized class name
77 protected function getCapitalizedClassPrefix () {
79 $className = $this->getClassPrefix();
82 $className = self::convertToClassName($className);
89 * Setter for class name
91 * @param $className Name of the class
94 protected final function setClassName ($className) {
95 $this->className = (string) $className;
99 * Getter for class prefix
101 * @return $classPrefix Last validated classPrefix
103 protected final function getClassPrefix () {
104 return $this->classPrefix;
108 * Setter for class prefix
110 * @param $classPrefix Last validated classPrefix
113 protected final function setClassPrefix ($classPrefix) {
114 $this->classPrefix = (string) $classPrefix;
118 * Getter for (last) resolved instance
120 * @return $resolvedInstance Last validated resolvedInstance
122 protected final function getResolvedInstance () {
123 return $this->resolvedInstance;
127 * Setter for (last) resolved instance
129 * @param $resolvedInstance (Last) validated resolved instance
132 protected final function setResolvedInstance (FrameworkInterface $resolvedInstance) {
133 $this->resolvedInstance = $resolvedInstance;