X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=b725a85658143712d8edd560802c46ff2aad221b;hb=390641f83ec749cc41a77bb80357105c200abb43;hp=d8d095f06ac7e9957055aa95d0dfc0e199485559;hpb=fd80d47afc96ae0c0759530800051a0f07eb9c92;p=shipsimu.git diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index d8d095f..b725a85 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -33,6 +33,21 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private static $langInstance = null; + /** + * Instance of a request class + */ + private $requestInstance = null; + + /** + * Instance of a response class + */ + private $responseInstance = null; + + /** + * Search criteria instance + */ + private $searchInstance = null; + /** * The real class name */ @@ -121,6 +136,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x034; const EXCEPTION_CLASS_NOT_FOUND = 0x035; const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x036; + const EXCEPTION_FATAL_ERROR = 0x037; + const EXCEPTION_FILE_NOT_FOUND = 0x038; /** * In the super constructor these system classes shall be ignored or else @@ -267,7 +284,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class'); // Set debug instance - $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine'))); + $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_class'))); // Get output instance and set it $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type'))); @@ -407,6 +424,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { self::$applicationInstance = $applicationInstance; } + /** + * Setter for request instance + * + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public final function setRequestInstance (Requestable $requestInstance) { + $this->requestInstance = $requestInstance; + } + + /** + * Getter for request instance + * + * @return $requestInstance An instance of a Requestable class + */ + public final function getRequestInstance () { + return $this->requestInstance; + } + + /** + * Setter for response instance + * + * @param $responseInstance An instance of a Responseable class + * @return void + */ + public final function setResponseInstance (Responseable $responseInstance) { + $this->responseInstance = $responseInstance; + } + + /** + * Getter for response instance + * + * @return $responseInstance An instance of a Responseable class + */ + public final function getResponseInstance () { + return $this->responseInstance; + } + /** * Getter for $realClass * @@ -821,7 +876,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // Initialize the template engine - $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance())); + $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance())); // Return the prepared instance return $tplEngine; @@ -839,7 +894,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Output it - ApplicationEntryPoint::app_die(sprintf("%s debug output:%s", $this->__toString(), $content)); + ApplicationEntryPoint::app_die(sprintf("%s debug output:
%s
Loaded includes:
%s
", + $this->__toString(), + $content, + ClassLoader::getInstance()->getPrintableIncludeList() + )); } /** @@ -866,7 +925,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Is the extra message given? if (!empty($message)) { // Then add it as well - $stubMessage .= sprintf(" Message: %s", $message); + $stubMessage .= sprintf(" Message: %s", $message); } // Debug instance is there? @@ -886,10 +945,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $className Generated class name */ public function convertToClassName ($str) { + // Init class name $className = ""; + + // Convert all dashes in underscores + $str = str_replace("-", "_", $str); + + // Now use that underscores to get classname parts for hungarian style foreach (explode("_", $str) as $strPart) { + // Make the class name part lower case and first upper case $className .= ucfirst(strtolower($strPart)); - } + } // END - foreach + + // Return class name return $className; } @@ -905,6 +973,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { print ""; exit; } + + /** + * Setter for search instance + * + * @param $searchInstance Searchable criteria instance + * @return void + */ + public final function setSearchInstance (LocalSearchCriteria $searchInstance) { + $this->searchInstance = $searchInstance; + } + + /** + * Getter for search instance + * + * @return $searchInstance Searchable criteria instance + */ + public final function getSearchInstance () { + return $this->searchInstance; + } } // [EOF]