X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fclass_BaseFrameworkSystem.php;h=fa862a188522d40dc4e04b27a2137f35bee7d01c;hp=132d5bead183dfded68bd84dbbf9eec2ce96f3f3;hb=ba9c65f936c374390a63226533172121b9ae3f45;hpb=835d890d25d67c76e40ffdf3ba525b8b18c5d007 diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 132d5be..fa862a1 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -63,6 +63,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $resolverInstance = null; + /** + * Template engine instance + */ + private $templateInstance = null; + /** * The real class name */ @@ -141,12 +146,13 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { const EXCEPTION_MISSING_FILE_IO_HANDLER = 0x02f; const EXCEPTION_MISSING_ELEMENT = 0x030; const EXCEPTION_HEADERS_ALREADY_SENT = 0x031; - const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x032; + const EXCEPTION_DEFAULT_CONTROLLER_GONE = 0x032; const EXCEPTION_CLASS_NOT_FOUND = 0x033; const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x034; const EXCEPTION_FATAL_ERROR = 0x035; const EXCEPTION_FILE_NOT_FOUND = 0x036; const EXCEPTION_ASSERTION_FAILED = 0x037; + const EXCEPTION_FILE_CANNOT_BE_READ = 0x038; /** * In the super constructor these system classes shall be ignored or else @@ -197,17 +203,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public function __destruct() { // Is this object already destroyed? - if ($this->__toString() != "DestructedObject") { - // Debug message - if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.", - __CLASS__, $this->__toString() - )); - } // END - if - + if ($this->__toString() != 'DestructedObject') { // Destroy all informations about this class but keep some text about it alive - $this->setObjectDescription(sprintf("Entferntes Objekt %s", $this->__toString())); - $this->setRealClass("DestructedObject"); + $this->setObjectDescription(sprintf("Removed object %s", $this->__toString())); + $this->setRealClass('DestructedObject'); $this->resetUniqueID(); } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { // Already destructed object @@ -313,13 +312,32 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ))); // Initialization done! :D - Registry::isInitialized("OK"); - } elseif ($this->__toString() == "DebugMiddleware") { + Registry::isInitialized('OK'); + } elseif ($this->__toString() == 'DebugMiddleware') { // Set configuration instance $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); } } + /** + * Setter for template engine instances + * + * @param $templateInstance An instance of a template engine class + * @return void + */ + protected final function setTemplateInstance (CompileableTemplate $templateInstance) { + $this->templateInstance = $templateInstance; + } + + /** + * Getter for template engine instances + * + * @return $templateInstance An instance of a template engine class + */ + protected final function getTemplateInstance () { + return $this->templateInstance; + } + /** * Setter for search instance * @@ -374,7 +392,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @return $cfgInstance Configuration instance */ - protected final function getConfigInstance () { + public final function getConfigInstance () { $cfgInstance = Registry::getRegistry()->getInstance('config'); return $cfgInstance; } @@ -824,10 +842,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * The left part of the ID shall always be a valid class name and the * right part an ID number. * - * @return $pfn The file name with a prepended path name - * @throws NoArrayCreatedException If explode() fails to create an array + * @return $pfn The file name with a prepended path name + * @throws NoArrayCreatedException If explode() fails to create an array * @throws InvalidArrayCountException If the array contains less or - * more than two elements + * more than two elements */ public final function getPathFileNameFromObject () { // Get the main object's unique ID. We use this as a path/filename combination @@ -839,10 +857,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Are there two elements? Index 0 is the path, 1 the file name + global extension if (!is_array($pathFile)) { // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED); } elseif (count($pathFile) != 2) { // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } // Auto-append missing trailing slash @@ -998,7 +1016,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @return void */ - public function debugBacktrace () { + public function debugBackTrace () { // Sorry, there is no other way getting this nice backtrace print "
\n";
 		debug_print_backtrace();