3 * The simulator system class is the super class of all other classes. This
4 * class handles saving of games etc.
6 * @author Roland Haeder <webmaster@ship-simu.org>
8 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
9 * @license GNU GPL 3.0 or any newer version
10 * @link http://www.ship-simu.org
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
27 * Instance to an application helper class
29 private static $applicationInstance = null;
32 * The language instance for the template loader
34 private static $langInstance = null;
36 * Instance of a request class
38 private $requestInstance = null;
41 * Instance of a response class
43 private $responseInstance = null;
48 private $realClass = "FrameworkSystem";
51 * A human-readable description for this simulator part
53 private $objectDescription = "Namenlose Framework-Einheit";
56 * The unique ID string for identifying all type of classes
58 private $uniqueID = "";
63 private $thousands = "."; // German
68 private $decimals = ","; // German
71 * The file I/O instance for the template loader
73 private $fileIoInstance = null;
75 /***********************
76 * Exception codes.... *
77 ***********************/
79 const EXCEPTION_IS_NULL_POINTER = 0x001;
80 const EXCEPTION_IS_NO_OBJECT = 0x002;
81 const EXCEPTION_IS_NO_ARRAY = 0x003;
82 const EXCEPTION_MISSING_METHOD = 0x004;
83 const EXCEPTION_CLASSES_NOT_MATCHING = 0x005;
84 const EXCEPTION_INDEX_OUT_OF_BOUNDS = 0x006;
85 const EXCEPTION_DIMENSION_ARRAY_INVALID = 0x007;
86 const EXCEPTION_ITEM_NOT_TRADEABLE = 0x008;
87 const EXCEPTION_ITEM_NOT_IN_PRICE_LIST = 0x009;
88 const EXCEPTION_GENDER_IS_WRONG = 0x00a;
89 const EXCEPTION_BIRTH_DATE_IS_INVALID = 0x00b;
90 const EXCEPTION_EMPTY_STRUCTURES_ARRAY = 0x00c;
91 const EXCEPTION_HAS_ALREADY_PERSONELL_LIST = 0x00d;
92 const EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES = 0x00e;
93 const EXCEPTION_TOTAL_PRICE_NOT_CALCULATED = 0x00f;
94 const EXCEPTION_HARBOR_HAS_NO_SHIPYARDS = 0x010;
95 const EXCEPTION_CONTRACT_PARTNER_INVALID = 0x011;
96 const EXCEPTION_CONTRACT_PARTNER_MISMATCH = 0x012;
97 const EXCEPTION_CONTRACT_ALREADY_SIGNED = 0x013;
98 const EXCEPTION_UNEXPECTED_EMPTY_STRING = 0x014;
99 const EXCEPTION_PATH_NOT_FOUND = 0x015;
100 const EXCEPTION_INVALID_PATH_NAME = 0x016;
101 const EXCEPTION_READ_PROTECED_PATH = 0x017;
102 const EXCEPTION_WRITE_PROTECED_PATH = 0x018;
103 const EXCEPTION_DIR_POINTER_INVALID = 0x019;
104 const EXCEPTION_FILE_POINTER_INVALID = 0x01a;
105 const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b;
106 const EXCEPTION_UNEXPECTED_OBJECT = 0x01c;
107 const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d;
108 const EXCEPTION_GETTER_IS_MISSING = 0x01e;
109 const EXCEPTION_ARRAY_EXPECTED = 0x01f;
110 const EXCEPTION_ARRAY_HAS_INVALID_COUNT = 0x020;
111 const EXCEPTION_ID_IS_INVALID_FORMAT = 0x021;
112 const EXCEPTION_MD5_CHECKSUMS_MISMATCH = 0x022;
113 const EXCEPTION_UNEXPECTED_STRING_SIZE = 0x023;
114 const EXCEPTION_SIMULATOR_ID_INVALID = 0x024;
115 const EXCEPTION_MISMATCHING_COMPRESSORS = 0x025;
116 const EXCEPTION_CONTAINER_ITEM_IS_NULL = 0x026;
117 const EXCEPTION_ITEM_IS_NO_ARRAY = 0x027;
118 const EXCEPTION_CONTAINER_MAYBE_DAMAGED = 0x028;
119 const EXCEPTION_INVALID_STRING = 0x029;
120 const EXCEPTION_VARIABLE_NOT_SET = 0x02a;
121 const EXCEPTION_ATTRIBUTES_ARE_MISSING = 0x02b;
122 const EXCEPTION_ARRAY_ELEMENTS_MISSING = 0x02c;
123 const EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED = 0x02d;
124 const EXCEPTION_MISSING_LANGUAGE_HANDLER = 0x02e;
125 const EXCEPTION_MISSING_FILE_IO_HANDLER = 0x02f;
126 const EXCEPTION_MISSING_ELEMENT = 0x030;
127 const EXCEPTION_INVALID_COMMAND = 0x031;
128 const EXCEPTION_INVALID_CONTROLLER = 0x032;
129 const EXCEPTION_HEADERS_ALREADY_SENT = 0x033;
130 const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x034;
131 const EXCEPTION_CLASS_NOT_FOUND = 0x035;
132 const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x036;
135 * In the super constructor these system classes shall be ignored or else
136 * we would get an endless calling loop.
138 *--------------------------------------------------------------------*
139 * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! *
140 *--------------------------------------------------------------------*
142 private $systemClasses = array(
143 "DebugMiddleware", // Debug middleware output sub-system
144 "Registry", // Object registry
145 "ObjectFactory", // Object factory
146 "DebugWebOutput", // Debug web output sub-system
147 "WebOutput", // Web output sub-system
148 "CompressorChannel", // Compressor sub-system
149 "DebugConsoleOutput", // Debug console output sub-system
150 "DebugErrorLogOutput", // Debug error_log() output sub-system
151 "FrameworkDirectoryPointer", // Directory handler sub-system
152 "NullCompressor", // Null compressor
153 "Bzip2Compressor", // BZIP2 compressor
154 "GzipCompressor", // GZIP compressor
161 * Private super constructor
165 protected function __construct ($class) {
167 $this->setRealClass($class);
169 // Initialize the class if the registry is there
170 if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
171 $this->initInstance();
176 * Destructor reached...
180 public function __destruct() {
181 // Is this object already destroyed?
182 if ($this->__toString() != "DestructedObject") {
184 if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
185 $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wird zerstört.<br />\n",
186 __CLASS__, $this->__toString()
190 // Destroy all informations about this class but keep some text about it alive
191 $this->setObjectDescription(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
192 $this->setRealClass("DestructedObject");
193 $this->resetUniqueID();
194 } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
195 // Already destructed object
196 $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wurde bereits zerstört.<br />\n",
197 __CLASS__, $this->__toString()
203 * The call method where all non-implemented methods end up
207 public final function __call ($methodName, $args) {
208 // Implode all given arguments
212 $argsString = "NULL";
213 } elseif (is_array($args)) {
214 // Some arguments are there
215 foreach ($args as $arg) {
219 if ($arg) $argsString .= "true(bool)"; else $argsString .= "false(bool)";
220 } elseif (is_int($arg)) {
222 $argsString .= $arg."(int)";
223 } elseif (is_float($arg)) {
225 $argsString .= $arg."(float)";
226 } elseif ($arg instanceof BaseFrameworkSystem) {
227 // Own object instance
228 $argsString .= $arg->__toString()."(Object)";
229 } elseif (is_object($arg)) {
231 $argsString .= "unknown object(!)";
232 } elseif (is_array($arg)) {
234 $argsString .= "Array(array)";
235 } elseif (is_string($arg)) {
237 $argsString .= "\"".$arg."\"(string)";
238 } elseif (is_null($arg)) {
240 $argsString .= "(null)";
242 // Unknown type (please report!)
243 $argsString .= $arg."(unknown!)";
251 if (substr($argsString, -2, 1) === ",") $argsString = substr($argsString, 0, -2);
253 // Invalid arguments!
254 $argsString = sprintf("!INVALID:%s!", $args);
257 $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s",
268 * Private initializer for this class
272 private final function initInstance () {
273 // Is this a system class?
274 if (!in_array($this->__toString(), $this->systemClasses)) {
275 // Add application helper to our class
276 $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class');
278 // Set debug instance
279 $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_class')));
281 // Get output instance and set it
282 $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
283 $this->setWebOutputInstance($outputInstance);
285 // Set the compressor channel
286 $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s",
288 $this->getConfigInstance()->readConfig('compressor_base_path')
291 // Initialization done! :D
292 Registry::isInitialized("OK");
293 } elseif ($this->__toString() == "DebugMiddleware") {
294 // Set configuration instance
295 $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
300 * Setter for language instance
302 * @param $configInstance The configuration instance which shall
303 * be FrameworkConfiguration
306 public final function setConfigInstance (FrameworkConfiguration $configInstance) {
307 Registry::getRegistry()->addInstance('config', $configInstance);
311 * Getter for configuration instance
313 * @return $cfhInstance - Configuration instance
315 protected final function getConfigInstance () {
316 return Registry::getRegistry()->getInstance('config');
320 * Setter for debug instance
322 * @param $debugInstance The instance for debug output class
325 public final function setDebugInstance (DebugMiddleware $debugInstance) {
326 Registry::getRegistry()->addInstance('debug', $debugInstance);
330 * Getter for debug instance
332 * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput
334 public final function getDebugInstance () {
335 return Registry::getRegistry()->getInstance('debug');
339 * Setter for web output instance
341 * @param $webInstance The instance for web output class
344 public final function setWebOutputInstance (OutputStreamer $webInstance) {
345 Registry::getRegistry()->addInstance('web_output', $webInstance);
349 * Getter for web output instance
351 * @return $webOutput - Instance to class WebOutput
353 public final function getWebOutputInstance () {
354 return Registry::getRegistry()->getInstance('web_output');
358 * Setter for database instance
360 * @param $dbInstance The instance for the database connection
361 * (forced DatabaseConnection)
364 public final function setDatabaseInstance (DatabaseConnection $dbInstance) {
365 Registry::getRegistry()->addInstance('dbInstance', $dbInstance);
369 * Getter for database layer
371 * @return $dbInstance The database layer instance
373 public final function getDatabaseInstance () {
374 if ((class_exists('Registry')) && (Registry::isInitialized() === true)) {
375 return Registry::getRegistry()->getInstance('dbInstance');
382 * Setter for compressor channel
384 * @param $compressorChannel An instance of CompressorChannel
387 public final function setCompressorChannel (CompressorChannel $compressorChannel) {
388 Registry::getRegistry()->addInstance('compressor', $compressorChannel);
392 * Getter for compressor channel
394 * @return $compressor The compressor channel
396 public final function getCompressorChannel () {
397 return Registry::getRegistry()->getInstance('compressor');
401 * Protected getter for a manageable application helper class
403 * @return $applicationInstance An instance of a manageable application helper class
405 protected final function getApplicationInstance () {
406 return self::$applicationInstance;
410 * Setter for a manageable application helper class
412 * @param $applicationInstance An instance of a manageable application helper class
415 public final function setApplicationInstance (ManageableApplication $applicationInstance) {
416 self::$applicationInstance = $applicationInstance;
420 * Setter for request instance
422 * @param $requestInstance An instance of a Requestable class
425 public final function setRequestInstance (Requestable $requestInstance) {
426 $this->requestInstance = $requestInstance;
430 * Getter for request instance
432 * @return $requestInstance An instance of a Requestable class
434 public final function getRequestInstance () {
435 return $this->requestInstance;
439 * Setter for response instance
441 * @param $responseInstance An instance of a Responseable class
444 public final function setResponseInstance (Responseable $responseInstance) {
445 $this->responseInstance = $responseInstance;
449 * Getter for response instance
451 * @return $responseInstance An instance of a Responseable class
453 public final function getResponseInstance () {
454 return $this->responseInstance;
458 * Getter for $realClass
460 * @return $realClass The name of the real class (not BaseFrameworkSystem)
462 public final function __toString () {
463 return $this->realClass;
467 * Setter for the real class name
469 * @param $realClass Class name (string)
472 public final function setRealClass ($realClass) {
474 $realClass = (string) $realClass;
477 $this->realClass = $realClass;
481 * Generate unique ID from a lot entropy
485 public final function generateUniqueId () {
486 // Is the id set for this class?
487 if (empty($this->uniqueID)) {
489 // Correct missing class name
491 if ($this->__toString() == "") {
492 $this->setRealClass(__CLASS__);
496 // Cache datbase instance
497 $db = $this->getDatabaseInstance();
502 // Generate a unique ID number
503 $tempID = $this->generateIdNumber();
506 // Try to figure out if the ID number is not yet used
508 // Is this a registry?
509 if ($this->__toString() == "Registry") {
510 // Registry, then abort here
512 } elseif (is_object($db)) {
513 $isUsed = $db->isUniqueIdUsed($tempID, true);
515 } catch (FrameworkException $e) {
516 // Catches all and ignores all ;-)
540 $this->setUniqueID($tempID);
542 // Revert maybe corrected class name
544 $this->setRealClass("");
547 // Remove system classes if we are in a system class
548 if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) {
549 // This may save some RAM...
550 $this->removeSystemArray();
556 * Generates a new ID number for classes based from the class' real name,
557 * the description and some random data
559 * @return $tempID The new (temporary) ID number
561 private final function generateIdNumber () {
562 return sprintf("%s@%s",
564 md5(sprintf("%s:%s:%s:%s:%s:%s",
566 $this->getObjectDescription(),
568 getenv('REMOTE_ADDR'),
569 getenv('SERVER_ADDR'),
576 * Setter for unique ID
578 * @param $uniqueID The newly generated unique ID number
581 private final function setUniqueID ($uniqueID) {
583 $uniqueID = (string) $uniqueID;
586 $this->uniqueID = $uniqueID;
590 * Getter for unique ID
592 * @return $uniqueID The unique ID of this class
594 public final function getUniqueID () {
595 return $this->uniqueID;
599 * Resets or recreates the unique ID number
603 public final function resetUniqueID() {
604 // Sweet and simple... ;-)
605 $newUniqueID = $this->generateIdNumber();
606 $this->setUniqueID($newUniqueID);
610 * Getter for simulator description
612 * @return $objectDescription The description of this simulation part
614 public final function getObjectDescription () {
615 if (isset($this->objectDescription)) {
616 return $this->objectDescription;
623 * Setter for simulation part description
625 * @param $objectDescription The description as string for this simulation part
628 public final function setObjectDescription ($objectDescription) {
629 $this->objectDescription = (String) $objectDescription;
633 * Validate if given object is the same as current
635 * @param $object An object instance for comparison with this class
636 * @return boolean The result of comparing both's unique ID
638 public final function equals ($object) {
639 return ($this->getUniqueID() == $object->getUniqueID());
643 * Compare if both simulation part description and class name matches
646 * @param $itemInstance An object instance to an other class
647 * @return boolean The result of comparing class name simulation part description
649 public function itemMatches ($itemInstance) {
652 $this->__toString() == $itemInstance->__toString()
654 $this->getObjectDescription() == $itemInstance->getObjectDescription()
660 * Compare class name of this and given class name
662 * @param $class The class name as string from the other class
663 * @return boolean The result of comparing both class names
665 public final function isClass ($class) {
666 return ($this->__toString() == $class);
670 * Stub method (only real cabins shall override it)
672 * @return boolean false = is no cabin, true = is a cabin
674 public function isCabin () {
679 * Stub method for tradeable objects
681 * @return boolean false = is not tradeable by the Merchant class,
682 * true = is a tradeable object
684 public function isTradeable () {
689 * Formats computer generated price values into human-understandable formats
690 * with thousand and decimal seperators.
692 * @param $value The in computer format value for a price
693 * @param $currency The currency symbol (use HTML-valid characters!)
694 * @param $decNum Number of decimals after commata
695 * @return $price The for the current language formated price string
696 * @throws MissingDecimalsThousandsSeperatorException If decimals or
697 * thousands seperator
700 public function formatCurrency ($value, $currency = "€", $decNum = 2) {
701 // Are all required attriutes set?
702 if ((!isset($this->decimals)) || (!isset($this->thousands))) {
703 // Throw an exception
704 throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING);
708 $value = (float) $value;
710 // Reformat the US number
711 $price = sprintf("%s %s",
712 number_format($value, $decNum, $this->decimals, $this->thousands),
716 // Return as string...
721 * Removes number formating characters
725 public final function removeNumberFormaters () {
726 unset($this->thousands);
727 unset($this->decimals);
731 * Private getter for language instance
733 * @return $langInstance An instance to the language sub-system
735 protected final function getLanguageInstance () {
736 return self::$langInstance;
740 * Setter for language instance
742 * @param $langInstance An instance to the language sub-system
744 * @see LanguageSystem
746 public final function setLanguageInstance (ManageableLanguage $langInstance) {
747 self::$langInstance = $langInstance;
751 * Remove the $systemClasses array from memory
755 public final function removeSystemArray () {
756 unset($this->systemClasses);
760 * Create a file name and path name from the object's unique ID number.
761 * The left part of the ID shall always be a valid class name and the
762 * right part an ID number.
764 * @return $pfn The file name with a prepended path name
765 * @throws NoArrayCreatedException If explode() fails to create an array
766 * @throws InvalidArrayCountException If the array contains less or
767 * more than two elements
769 public final function getPathFileNameFromObject () {
770 // Get the main object's unique ID. We use this as a path/filename combination
771 $pathFile = $this->getUniqueID();
773 // Split it up in path and file name
774 $pathFile = explode("@", $pathFile);
776 // Are there two elements? Index 0 is the path, 1 the file name + global extension
777 if (!is_array($pathFile)) {
779 throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
780 } elseif (count($pathFile) != 2) {
781 // Invalid ID returned!
782 throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
785 // Auto-append missing trailing slash
786 $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]);
788 // Create the file name and return it
789 $pfn = ($pathFile[0] . $pathFile[1]);
794 * Appends a trailing slash to a string
796 * @param $str A string (maybe) without trailing slash
797 * @return $str A string with an auto-appended trailing slash
799 public final function addMissingTrailingSlash ($str) {
800 // Is there a trailing slash?
801 if (substr($str, -1, 1) != "/") $str .= "/";
806 * Private getter for file IO instance
808 * @return $fileIoInstance An instance to the file I/O sub-system
810 protected final function getFileIoInstance () {
811 return $this->fileIoInstance;
815 * Setter for file I/O instance
817 * @param $fileIoInstance An instance to the file I/O sub-system
820 public final function setFileIoInstance (FileIoHandler $fileIoInstance) {
821 $this->fileIoInstance = $fileIoInstance;
825 * Prepare the template engine (TemplateEngine by default) for a given
826 * application helper instance (ApplicationHelper by default).
828 * @param $appInstance An application helper instance or
829 * null if we shall use the default
830 * @return $tplEngine The template engine instance
831 * @throws NullPointerException If the template engine could not
833 * @throws UnsupportedTemplateEngineException If $tplEngine is an
834 * unsupported template engine
835 * @throws MissingLanguageHandlerException If the language sub-system
836 * is not yet initialized
837 * @throws NullPointerException If the discovered application
838 * instance is still null
840 protected function prepareTemplateEngine (BaseFrameworkSystem $appInstance=null) {
841 // Is the application instance set?
842 if (is_null($appInstance)) {
843 // Get the current instance
844 $appInstance = $this->getApplicationInstance();
847 if (is_null($appInstance)) {
848 // Thrown an exception
849 throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
853 // Generate FQFN for all application templates
854 $fqfn = sprintf("%s%s/%s/%s",
856 $this->getConfigInstance()->readConfig('application_path'),
857 strtolower($appInstance->getAppShortName()),
858 $this->getConfigInstance()->readConfig('tpl_base_path')
861 // Are both instances set?
862 if ($appInstance->getLanguageInstance() === null) {
863 // Invalid language instance
864 throw new MissingLanguageHandlerException($appInstance, self::EXCEPTION_MISSING_LANGUAGE_HANDLER);
865 } elseif ($appInstance->getFileIoInstance() === null) {
866 // Invalid language instance
867 throw new MissingFileIoHandlerException($appInstance, self::EXCEPTION_MISSING_FILE_IO_HANDLER);
870 // Initialize the template engine
871 $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
873 // Return the prepared instance
878 * Debugs this instance by putting out it's full content
882 public final function debugInstance () {
883 // Generate the output
884 $content = sprintf("<pre>%s</pre>",
885 trim(print_r($this, true))
889 ApplicationEntryPoint::app_die(sprintf("<strong>%s debug output:</strong>%s", $this->__toString(), $content));
893 * Output a partial stub message for the caller method
895 * @param $message An optional message to display
898 protected function partialStub ($message = "") {
900 $backtrace = debug_backtrace();
902 // Generate the class::method string
903 $methodName = "UnknownClass::unknownMethod";
904 if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
905 $methodName = $backtrace[1]['class']."::".$backtrace[1]['function'];
908 // Construct the full message
909 $stubMessage = sprintf("[%s:] Partial stub!",
913 // Is the extra message given?
914 if (!empty($message)) {
915 // Then add it as well
916 $stubMessage .= sprintf(" Message: <u>%s</u>", $message);
919 // Debug instance is there?
920 if (!is_null($this->getDebugInstance())) {
921 // Output stub message
922 $this->getDebugInstance()->output($stubMessage);
925 trigger_error($stubMessage."<br />\n");
930 * Converts e.g. a command from URL to a valid class by keeping out bad characters
932 * @param $str The string, what ever it is needs to be converted
933 * @return $className Generated class name
935 public function convertToClassName ($str) {
939 // Convert all dashes in underscores
940 $str = str_replace("-", "_", $str);
942 // Now use that underscores to get classname parts for hungarian style
943 foreach (explode("_", $str) as $strPart) {
944 // Make the class name part lower case and first upper case
945 $className .= ucfirst(strtolower($strPart));
953 * Outputs a debug backtrace and stops further script execution
957 public function debugBacktrace () {
958 // Sorry, there is no other way getting this nice backtrace
960 debug_print_backtrace();